35 lines
926 B
JavaScript
35 lines
926 B
JavaScript
import { build } from "esbuild";
|
|
|
|
const platformModules = new Map([
|
|
[
|
|
"@quixos/web-studio-react-runtime",
|
|
"/__quixos/platform/web-studio-react-runtime/v1.mjs",
|
|
],
|
|
["react", "/__quixos/platform/react/v18.mjs"],
|
|
["react/jsx-runtime", "/__quixos/platform/react-jsx-runtime/v18.mjs"],
|
|
["react/jsx-dev-runtime", "/__quixos/platform/react-jsx-dev-runtime/v18.mjs"],
|
|
]);
|
|
|
|
await build({
|
|
entryPoints: ["dist/project-component.js"],
|
|
outfile: "dist/project-component.mjs",
|
|
bundle: true,
|
|
format: "esm",
|
|
platform: "browser",
|
|
target: "es2022",
|
|
sourcemap: true,
|
|
plugins: [
|
|
{
|
|
name: "quixos-platform-modules",
|
|
setup(buildApi) {
|
|
buildApi.onResolve({ filter: /.*/ }, (args) => {
|
|
const platformPath = platformModules.get(args.path);
|
|
return platformPath
|
|
? { path: platformPath, external: true }
|
|
: undefined;
|
|
});
|
|
},
|
|
},
|
|
],
|
|
});
|