When including this function, I get the following error:
ERROR in ./src/utils/localization.ts 11:46-13:58
Module not found: Error: Package path ./dist/translations is not exported from package /home/project/node_modules/@shoelace-style/shoelace (see exports field in /home/project/node_modules/@shoelace-style/shoelace/package.json)
Because Shoelace's package.json only exports the contents of the ./dist/translations directory and not the directory itself, Webpack refuses to let me consume it.
If I go into node_modules and manually add the ./dist/translations directory in addition to the other imports like this:
Describe the bug
Say I have the following function to dynamically import Shoelace translations when bundling Shoelace using Webpack:
When including this function, I get the following error:
Because Shoelace's
package.json
only exports the contents of the./dist/translations
directory and not the directory itself, Webpack refuses to let me consume it.If I go into
node_modules
and manually add the./dist/translations
directory in addition to the other imports like this:Then the import is allowed to be done.
A workaround is to manually list every import:
But this is tedious and has to be updated every time a new locale is added.
Browser / OS
5.95.0
5.1.4