Master merge first attempt

This commit is contained in:
Mark Tolmacs 2025-01-07 09:41:32 +01:00
parent 1e819a2acf
commit 550c874c9b
No known key found for this signature in database
419 changed files with 24252 additions and 3446 deletions

View file

@ -97,38 +97,65 @@ const createESMBrowserBuild = async () => {
// );
// });
const rawConfig = {
entryPoints: ["index.tsx"],
const rawConfigCommon = {
bundle: true,
format: "esm",
plugins: [sassPlugin()],
assetNames: "[dir]/[name]-[hash]",
loader: {
".json": "copy",
".woff2": "file",
},
packages: "external",
// chunks are always external, so they are not bundled within and get build separately
external: ["*.chunk"],
};
const createESMRawBuild = async () => {
// Development unminified build with source maps
await build({
...rawConfig,
const rawConfigIndex = {
...rawConfigCommon,
entryPoints: ["index.tsx"],
};
const rawConfigChunks = {
...rawConfigCommon,
// create a separate chunk for each
entryPoints: ["**/*.chunk.ts"],
};
function buildDev(chunkConfig) {
const config = {
...chunkConfig,
sourcemap: true,
outdir: "dist/dev",
define: {
"import.meta.env": JSON.stringify({ DEV: true }),
},
});
outdir: "dist/dev",
};
// production minified build without sourcemaps
await build({
...rawConfig,
return build(config);
}
function buildProd(chunkConfig) {
const config = {
...chunkConfig,
minify: true,
outdir: "dist/prod",
define: {
"import.meta.env": JSON.stringify({ PROD: true }),
},
});
outdir: "dist/prod",
};
return build(config);
}
const createESMRawBuild = async () => {
// development unminified build with source maps
await buildDev(rawConfigIndex);
await buildDev(rawConfigChunks);
// production minified buld without sourcemaps
await buildProd(rawConfigIndex);
await buildProd(rawConfigChunks);
};
createESMRawBuild();