From 7da4d250a18754d8d99fb42370ffb174821d2cfc Mon Sep 17 00:00:00 2001 From: glaszig Date: Sat, 6 Aug 2022 06:12:51 -0300 Subject: [PATCH] Fix `exports` field for `stimulus` package and Webpack 5 (#569) 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/ --- packages/stimulus/package.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/stimulus/package.json b/packages/stimulus/package.json index 99065acb..9a76c624 100644 --- a/packages/stimulus/package.json +++ b/packages/stimulus/package.json @@ -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",