Skip to content

Commit

Permalink
build: Use commonjs by default in package for better backward compati…
Browse files Browse the repository at this point in the history
…bility
  • Loading branch information
tristanmenzel committed Feb 9, 2024
1 parent 1bf5b7f commit be696a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"engines": {
"node": ">=19.0"
},
"type": "module",
"type": "commonjs",
"scripts": {
"audit": "better-npm-audit audit",
"dev": "run-s dev:*",
Expand All @@ -26,7 +26,7 @@
"build:2-lint": "eslint \"src/**/*.ts\" \"examples/**/*.spec.ts\" --max-warnings 0",
"build:3-check-types": "tsc -p tsconfig.json",
"build:4-build": "rollup -c --configPlugin typescript",
"build:5-copy-pkg-json": "npx --yes @makerx/ts-toolkit@latest copy-package-json --input-folder ./ --output-folder ./dist --main index.cjs --types index.d.ts --custom-sections module type ",
"build:5-copy-pkg-json": "npx --yes @makerx/ts-toolkit@latest copy-package-json --input-folder ./ --output-folder ./dist --main index.js --types index.d.ts --custom-sections module type ",
"build:6-copy-bin": "copyfiles bin/* dist/bin -f",
"build:7-copy-readme": "copyfiles ./README.md ./dist",
"format": "prettier --write .",
Expand Down
4 changes: 3 additions & 1 deletion rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ const config: RollupOptions = {
{
dir: 'dist',
format: 'cjs',
entryFileNames: '[name].cjs',
entryFileNames: '[name].js',
exports: 'named',
preserveModules: true,
sourcemap: true,
},
{
dir: 'dist',
format: 'es',
exports: 'named',
entryFileNames: '[name].mjs',
preserveModules: true,
sourcemap: true,
},
],
treeshake: {
Expand Down

0 comments on commit be696a9

Please sign in to comment.