Skip to content

Commit

Permalink
build: avoid .mjs extension in esm builds to prevent error `Can't imp…
Browse files Browse the repository at this point in the history
…ort the named export 'useContext' from non EcmaScript module` in legacy consumer webpack builds
  • Loading branch information
nflatley-zengenti committed May 2, 2024
1 parent 316013a commit 4470cb8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"license": "ISC",
"main": "dist/canvas-react.js",
"module": "dist/canvas-react.mjs",
"module": "dist/esm/canvas-react.js",
"types": "dist/canvas-react.d.ts",
"files": [
"dist"
Expand All @@ -43,7 +43,7 @@
"exports": {
".": {
"require": "./dist/canvas-react.js",
"import": "./dist/canvas-react.mjs",
"import": "./dist/esm/canvas-react.js",
"types": "./dist/canvas-react.d.ts"
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/react/tsup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default defineConfig({
},
format: ['esm', 'cjs'],
target: 'es6',
legacyOutput: true, // outputs esm to folder avoiding .mjs file extension
// this runs tsc to do type checking during build but the console
// output is not as readable as vanilla tsc when there are problems to resolve
// dts: true,
Expand Down

0 comments on commit 4470cb8

Please sign in to comment.