yairEO / tagify

🔖 lightweight, efficient Tags input component in Vanilla JS / React / Angular / Vue
https://yaireo.github.io/tagify/
Other
3.48k stars 429 forks source link

add missing export for css file in package.json #1325

Closed grossmannmartin closed 4 months ago

grossmannmartin commented 4 months ago

Hi, our build just starts failing on

Module build failed (from ./node_modules/css-loader/dist/cjs.js):
Error: Can't resolve '../../../../../packages/framework/assets/styles/admin/~@yaireo/tagify/dist/tagify.css' in '/var/www/html/project-base/app/assets/styles/admin'
    at finishWithoutResolve (/var/www/html/project-base/app/node_modules/enhanced-resolve/lib/Resolver.js:564:18)
    at /var/www/html/project-base/app/node_modules/enhanced-resolve/lib/Resolver.js:656:15
    at /var/www/html/project-base/app/node_modules/enhanced-resolve/lib/Resolver.js:714:5
    at eval (eval at create (/var/www/html/project-base/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /var/www/html/project-base/app/node_modules/enhanced-resolve/lib/Resolver.js:714:5
    at eval (eval at create (/var/www/html/project-base/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at /var/www/html/project-base/app/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:89:43
    at /var/www/html/project-base/app/node_modules/enhanced-resolve/lib/Resolver.js:714:5
    at eval (eval at create (/var/www/html/project-base/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /var/www/html/project-base/app/node_modules/enhanced-resolve/lib/Resolver.js:714:5
    at eval (eval at create (/var/www/html/project-base/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /var/www/html/project-base/app/node_modules/enhanced-resolve/lib/Resolver.js:714:5
    at eval (eval at create (/var/www/html/project-base/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /var/www/html/project-base/app/node_modules/enhanced-resolve/lib/Resolver.js:714:5
    at eval (eval at create (/var/www/html/project-base/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at /var/www/html/project-base/app/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:89:43
    at /var/www/html/project-base/app/node_modules/enhanced-resolve/lib/Resolver.js:714:5
    at eval (eval at create (/var/www/html/project-base/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /var/www/html/project-base/app/node_modules/enhanced-resolve/lib/Resolver.js:714:5
    at eval (eval at create (/var/www/html/project-base/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /var/www/html/project-base/app/node_modules/enhanced-resolve/lib/DirectoryExistsPlugin.js:41:15
    at process.processTicksAndRejections (node:internal/process/task_queues:81:21)

The CSS file is imported in our *.less file and processed by Webpack

@import "~@yaireo/tagify/dist/tagify.css";

Adding the proposed export fixes the problem on our end. If it's intentional and the CSS file should be used differently, I would appreciate the info :)

Thanks

yairEO commented 4 months ago

I don't understand why this is happening to you and why would adding things to exports solves this. The CSS does exists in the ./dist folder since the exports does not have rewrite rule for CSS files your import should work, as it does for me when I test Tagify and can be seen to work in the live Codesandbox React demo.

exports is only for aliasing so I cannot see why would you use it to point the same path to itself..

when this issue started for you?

AnujShr commented 4 months ago

The latest update to the version 4.25.0 introduces this issue. it is working till 4.24.0

grossmannmartin commented 4 months ago

@yairEO TBH, I'm not so profound with the webpack to know how it's possible.

You can check our package.json and webpack.config.js if you're interested.

The version 4.24.0 works fine as @AnujShr mentioned earlier.

If I install 4.25.0, the error starts popping during the npm run build process. And if I manually edit the node_modules/@yaireo/tagify/package.json file and add the line from this PR, the build finishes successfully 🤷‍♂️

edit: According to this https://webpack.js.org/guides/package-exports/

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

russssl commented 4 months ago

Having same issue here, using vite

RaBic commented 4 months ago

same here, using vite

yairEO commented 4 months ago

will merge and release a new version

yairEO commented 4 months ago

Just pushed the new version:

https://github.com/yairEO/tagify/releases/tag/v4.25.1