We are using [rollup](https://rollupjs.org/) as a bundler for our projects. While upgrading one of the plugins, we've discovered the issue already described in their github:
as a folder, not a JS module. Since none exists, the builder throws the following error:
[!] (plugin commonjs--resolver) Error: Could not load /SAPDevelop/test-project/node_modules/@ui5/webcomponents-icons/dist/undo: ENOENT: no such file or directory, open '/SAPDevelop/test-project/node_modules/@ui5/webcomponents-icons/dist/undo'
The workaround on our (i.e. consuming) side would be adding a file extension postfix to the export line
import '@ui5/webcomponents-icons/dist/undo.js'
however, it would obviously be easier if the exports would have been set up correctly on the package level.
We are requesting this baring in mind we can be not the only ones coming up with the issue in the future.
Proposed Solution
Not sure what is the best way to resolve the issue. The guide on the webpack page suggests that adding a .js extension to the folder wildcard path is possible.
Feature Request Description
We are using
[rollup](https://rollupjs.org/)
as a bundler for our projects. While upgrading one of the plugins, we've discovered the issue already described in their github:https://github.com/rollup/plugins/issues/684
Practically, the problem is that if the path in the exports of package.json are set in such format as it is in some of the UI5 packages:
"exports": { "./dist/*": "./dist/*", "./package.json": "./package.json", "./*": "./dist/*" }
then node will recognise the following import
import '@ui5/webcomponents-icons/dist/undo'
as a folder, not a JS module. Since none exists, the builder throws the following error:
[!] (plugin commonjs--resolver) Error: Could not load /SAPDevelop/test-project/node_modules/@ui5/webcomponents-icons/dist/undo: ENOENT: no such file or directory, open '/SAPDevelop/test-project/node_modules/@ui5/webcomponents-icons/dist/undo'
The workaround on our (i.e. consuming) side would be adding a file extension postfix to the export line
import '@ui5/webcomponents-icons/dist/undo.js'
however, it would obviously be easier if the exports would have been set up correctly on the package level. We are requesting this baring in mind we can be not the only ones coming up with the issue in the future.
Proposed Solution
Not sure what is the best way to resolve the issue. The guide on the webpack page suggests that adding a .js extension to the folder wildcard path is possible.
"exports": { "./dist/*": "./dist/*.js", "./package.json": "./package.json", "./*": "./dist/*.js" }
Nevertheless, since the exported folders often contains nested folders, it might be reasonable to add some additional path templates.
Proposed Alternatives
No response
Additional Context
No response
Priority
Low
Privacy Policy