We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent db784cf commit 56a6ee5Copy full SHA for 56a6ee5
scripts/build.js
@@ -41,5 +41,23 @@ build({
41
42
build({
43
format: 'cjs',
44
+ bundle: true,
45
outExtension: { '.js': '.cjs' },
46
+ plugins: [
47
+ // @see https://github.com/evanw/esbuild/issues/622#issuecomment-769462611
48
+ {
49
+ name: 'change-extension-to-cjs',
50
+ setup(builder) {
51
+ // eslint-disable-next-line consistent-return
52
+ builder.onResolve({ filter: /.*/ }, (args) => {
53
+ if (args.importer) {
54
+ return {
55
+ path: args.path.replace(/\.js$/, '.cjs'),
56
+ external: true,
57
+ };
58
+ }
59
+ });
60
+ },
61
62
+ ],
63
});
0 commit comments