Skip to content

Commit

Permalink
🐞 fix (CHASE Backend): fix backend bundling for uglify plugin in mjml
Browse files Browse the repository at this point in the history
branch: deployment
  • Loading branch information
m1212e committed Mar 3, 2024
1 parent 399843d commit 051161d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion chase/backend/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,31 @@ if (await exists(outDir)) {
await rm(outDir, { recursive: true });
}

// https://github.com/mjmlio/mjml/issues/2132#issuecomment-1004713444
const emptyMjmlUglifyPlugin = {
name: "empty mjml uglify plugin",
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
setup(build: any) {
build.onLoad({ filter: /uglify-js\/tools\/node.js$/ }, () => ({
contents: "{}",
loader: "js",
}));
},
};

const r = await build({
entryPoints: [join(srcDir, "main.ts")],
bundle: true,
platform: "node",
target: ["node21.6"],
outdir: "./out",
format: "esm",
splitting: true,
splitting: false,
sourcemap: "external",
minify: true,
loader: { ".mjml": "file" },
treeShaking: true,
plugins: [emptyMjmlUglifyPlugin],
});

if (!r.errors && r.errors) {
Expand Down

0 comments on commit 051161d

Please sign in to comment.