Skip to content

Commit

Permalink
fix(utilities): fixed output file extensions (#480)
Browse files Browse the repository at this point in the history
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
  • Loading branch information
favna and vladfrangu committed Oct 2, 2022
1 parent 7b34a81 commit 99a011d
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions packages/utilities/tsup.config.ts
Expand Up @@ -2,8 +2,24 @@ import { createTsupConfig } from '../../scripts/tsup.config';

export default createTsupConfig({
target: 'es2019',
bundle: false,
bundle: true,
entry: ['src/**/*.ts', '!src/**/*.d.ts'],
format: ['esm', 'cjs'],
dts: false
dts: false,
esbuildPlugins: [
{
name: 'add-extension-to-file-imports-and-exports',
setup(build) {
const isEsm = build.initialOptions.define?.TSUP_FORMAT === '"esm"';
build.onResolve({ filter: /.*/ }, (args) => {
if (args.importer) {
return {
path: `${args.path}.${isEsm ? 'mjs' : 'js'}`,
external: true
};
}
});
}
}
]
});

0 comments on commit 99a011d

Please sign in to comment.