Skip to content

Commit

Permalink
Fix exports field for stimulus package and Webpack 5 (#569)
Browse files Browse the repository at this point in the history
without "." defined as export, webpack 5 won't find the requested module.
this happens because the exports field replaces the root-level "module", "main", "types", etc:

"When the exports field is specified, only these module requests are available. Any other requests will lead to a ModuleNotFound Error."

see https://webpack.js.org/guides/package-exports/
  • Loading branch information
glaszig committed Aug 6, 2022
1 parent da425c4 commit 7da4d25
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/stimulus/package.json
Expand Up @@ -13,6 +13,14 @@
"main": "./dist/stimulus.umd.js",
"types": "./index.d.ts",
"exports": {
".": {
"main": "./dist/stimulus.umd.js",
"browser": "./dist/stimulus.js",
"import": "./dist/stimulus.js",
"module": "./dist/stimulus.js",
"umd": "./dist/stimulus.umd.js",
"types": "./index.d.ts"
},
"./webpack-helpers": {
"main": "./dist/webpack-helpers.umd.js",
"browser": "./dist/webpack-helpers.js",
Expand Down

0 comments on commit 7da4d25

Please sign in to comment.