* Prepare repository for Amp orbs Amp-Thread-ID: https://ampcode.com/threads/T-019f8509-6815-71df-b137-f40075cd06f8 Co-authored-by: Akash Shakdwipeea <ashakdwipeea@gmail.com> * Declare Amp preview service and portal Amp-Thread-ID: https://ampcode.com/threads/T-019f8509-6815-71df-b137-f40075cd06f8 Co-authored-by: Akash Shakdwipeea <ashakdwipeea@gmail.com> * Allow E2B portal hosts in Vite preview Amp-Thread-ID: https://ampcode.com/threads/T-019f8509-6815-71df-b137-f40075cd06f8 Co-authored-by: Akash Shakdwipeea <ashakdwipeea@gmail.com> * Enable WebGPU for agent-browser Amp-Thread-ID: https://ampcode.com/threads/T-019f8509-6815-71df-b137-f40075cd06f8 Co-authored-by: Akash Shakdwipeea <ashakdwipeea@gmail.com> * Install virtual display for WebGPU captures Amp-Thread-ID: https://ampcode.com/threads/T-019f8509-6815-71df-b137-f40075cd06f8 Co-authored-by: Akash Shakdwipeea <ashakdwipeea@gmail.com> * Revert Amp orb setup pending review Amp-Thread-ID: https://ampcode.com/threads/T-019f8509-6815-71df-b137-f40075cd06f8 Co-authored-by: Akash Shakdwipeea <ashakdwipeea@gmail.com> * Prepare repository for Amp orbs Amp-Thread-ID: https://ampcode.com/threads/T-019f8509-6815-71df-b137-f40075cd06f8 Co-authored-by: Akash Shakdwipeea <ashakdwipeea@gmail.com> * Declare Amp preview service and portal Amp-Thread-ID: https://ampcode.com/threads/T-019f8509-6815-71df-b137-f40075cd06f8 Co-authored-by: Akash Shakdwipeea <ashakdwipeea@gmail.com> * Allow E2B portal hosts in Vite preview Amp-Thread-ID: https://ampcode.com/threads/T-019f8509-6815-71df-b137-f40075cd06f8 Co-authored-by: Akash Shakdwipeea <ashakdwipeea@gmail.com> * Enable WebGPU for agent-browser Amp-Thread-ID: https://ampcode.com/threads/T-019f8509-6815-71df-b137-f40075cd06f8 Co-authored-by: Akash Shakdwipeea <ashakdwipeea@gmail.com> * Install virtual display for WebGPU captures Amp-Thread-ID: https://ampcode.com/threads/T-019f8509-6815-71df-b137-f40075cd06f8 Co-authored-by: Akash Shakdwipeea <ashakdwipeea@gmail.com> * Address orb portal review feedback Amp-Thread-ID: https://ampcode.com/threads/T-019f8509-6815-71df-b137-f40075cd06f8 Co-authored-by: Akash Shakdwipeea <ashakdwipeea@gmail.com> --------- Co-authored-by: Amp <amp@ampcode.com>
67 lines
1.6 KiB
JavaScript
67 lines
1.6 KiB
JavaScript
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { defineConfig } from "vite";
|
|
import { ViteRsw } from "vite-plugin-rsw";
|
|
import wasm from "vite-plugin-wasm";
|
|
import copy from "rollup-plugin-copy";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
const portalHost = process.env.PUBLIC_URL
|
|
? new URL(process.env.PUBLIC_URL).hostname
|
|
: undefined;
|
|
|
|
export default defineConfig({
|
|
build: {
|
|
rollupOptions: {
|
|
input: {
|
|
app: "static/index.html",
|
|
},
|
|
},
|
|
// Relative to 'root'.
|
|
outDir: "../dist",
|
|
copyPublicDir: true,
|
|
},
|
|
// For getting out of index.html from dist/static directory.
|
|
root: "static",
|
|
publicDir: ".",
|
|
worker: {
|
|
format: "es",
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
pkg: path.resolve(__dirname, "level-editor/pkg"),
|
|
},
|
|
},
|
|
plugins: [
|
|
copy({
|
|
targets: [
|
|
{ src: "level-editor/pkg/*", dest: "static/level-editor/pkg" },
|
|
],
|
|
hook: "buildStart",
|
|
}),
|
|
ViteRsw(),
|
|
// Makes us be able to use top level await for wasm.
|
|
// Otherwise, we can restrict build.target to 'es2022', which allows top level await.
|
|
wasm(),
|
|
],
|
|
server: {
|
|
port: 8080,
|
|
headers: {
|
|
"Cross-Origin-Embedder-Policy": "require-corp",
|
|
"Cross-Origin-Opener-Policy": "same-origin",
|
|
},
|
|
fs: {
|
|
strict: false,
|
|
},
|
|
},
|
|
preview: {
|
|
port: 8080,
|
|
allowedHosts: portalHost ? [portalHost, ".e2b.app"] : [],
|
|
headers: {
|
|
"Cross-Origin-Embedder-Policy": "require-corp",
|
|
"Cross-Origin-Opener-Policy": "same-origin",
|
|
},
|
|
},
|
|
});
|