Skip to content

Commit

Permalink
Remove the CJS files from the package
Browse files Browse the repository at this point in the history
  • Loading branch information
titouanmathis committed Aug 1, 2024
1 parent 7d9ccae commit 6574212
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,3 @@ import { build } from './shared.mjs';
build({
format: 'esm',
});

build({
format: 'cjs',
bundle: true,
outExtension: { '.js': '.cjs' },
footer: {
// Fix `export default {}` assigned to `module.exports.default`
js: 'if (module.exports.default) module.exports = module.exports.default;'
},
plugins: [
// @see https://github.com/evanw/esbuild/issues/622#issuecomment-769462611
{
name: 'change-extension-to-cjs',
setup(builder) {
// eslint-disable-next-line consistent-return
builder.onResolve({ filter: /.*/ }, (args) => {
if (args.importer) {
return {
path: args.path.replace(/\.js$/, '.cjs'),
external: true,
};
}
});
},
},
],
});

0 comments on commit 6574212

Please sign in to comment.