-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v0.8.x]: cannot import in complex webpack-based workflows #439
Comments
Add some entries to `package.json` to improve compatibility with webpack - Add `import` export as per webpack requirements - Add `style` export for CSS file - Add `*.css` to "side effects" to prevent issues with tree-shaking With this commit, it is possible to import frappe-gantt without breaking changes in webpack-based applications Refs: - https://webpack.js.org/guides/package-exports/ Close frappe#439
Hello, I encountered an issue while using the "frappe-gantt" package with Vite. The error message I received was: [ERROR] Failed to resolve entry for package "frappe-gantt". The package may have incorrect main/module/exports specified in its package.json: No known conditions for "." specifier in "frappe-gantt" package [plugin vite:dep-scan] To resolve this, I modified the "exports" section in the package.json like this: "exports": {
".": {
"require": "./dist/frappe-gantt.umd.js",
"import": "./dist/frappe-gantt.umd.js"
}
} This change seems to have solved the issue! However, I'm not sure if this is related to this issue or not. |
Isn't supposed to be the
I'm confident it is, but I'm not a javascript developer |
You're right, both options seem to work, and using the es module feels more appropriate in this context. |
Add some entries to `package.json` to improve compatibility with webpack - Add `import` export as per webpack requirements - Add `style` export for CSS file - Add `*.css` to "side effects" to prevent issues with tree-shaking With this commit, it is possible to import frappe-gantt without breaking changes in webpack-based applications Refs: - https://webpack.js.org/guides/package-exports/ Close frappe#439
@frustak can you please check if |
Yes, it works out of the box for me. |
Is there a workaround for this until the PR is merged? |
Did you try my fork? |
I wasn't sure how to do that. I can't see an NPM package for it, and wasn't sure how I was hoping there would be a way to tell |
Should be possible in this way: In package.json - "frappe-gantt": "^0.8.0"
+ "frappe-gantt": "tagliala/gantt#chore/import-directive-webpack" or, according to your package manager
I don't know if there are ways in the host application package.json to override export directives. Maybe |
Thanks for your help. Adding a resolve section to my resolve: {
alias: {
'frappe-gantt': 'node_modules/frappe-gantt/dist/frappe-gantt.es.js',
},
}, With this in place, I can tell it to bypass the This seems to have the same effect as your fork. |
Hello,
I already have a PR for this, but I'm opening an issue for tracking purposes
After upgrading to v0.8.1, I was receiving an error related to a "missing export of
.
".Since it is time consuming to provide a reproducible test case, I can point to some of the most recent issues related to the addition of
exports
topackage.json
:style
package export for webpack based asset pipelines Choices-js/Choices#1184style
package export for webpack based asset pipelines Choices-js/Choices#1184 (comment)Ref: https://webpack.js.org/guides/package-exports/
I will submit a PR
The text was updated successfully, but these errors were encountered: