Skip to content

Commit

Permalink
fix: Set file extensions for package entry files
Browse files Browse the repository at this point in the history
If the package type is CommonJS all `.js` files will be handled
as if they are CommonJS, even if exports is set to module.
Same if type is set to ESM, then all `.js` files are handled as
if they are modules. So the file extension has to be set to the explicit type.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
  • Loading branch information
susnux committed Mar 8, 2023
1 parent a8b4ca6 commit ecb7495
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
"name": "@nextcloud/initial-state",
"version": "2.0.0",
"description": "Access data from the nextcloud server-side initial state API within apps.",
"main": "dist/index.js",
"module": "dist/index.esm.js",
"type": "module",
"main": "dist/index.cjs",
"types": "dist/index.d.ts",
"exports": {
"import": "./dist/index.esm.js",
"require": "./dist/index.js"
"import": "./dist/index.es.mjs",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
},
"files": [
"dist/"
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default [
],
output: [
{
dir: 'dist',
file: 'dist/index.cjs',
format: 'cjs',
sourcemap: true,
},
Expand All @@ -22,7 +22,7 @@ export default [
plugins: [typescript()],
output: [
{
file: 'dist/index.esm.js',
file: 'dist/index.es.mjs',
format: 'esm',
sourcemap: true,
},
Expand Down

0 comments on commit ecb7495

Please sign in to comment.