Skip to content
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

Fix package resolving in webpack projects #761

Merged
merged 1 commit into from
Feb 16, 2023
Merged

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Feb 15, 2023

Currently the 4.0.0 release can not be used with webpack projects, because they will throw:
ReferenceError: exports is not defined.

Webpack tries to resolve the import of @nextcloud/dialogs to node_modules/@nextcloud/dialogs/dist/index.js.
This is a commonjs file, but webpack expects an esm file, so exports is not defined.

I guess this happens because dialogs has its type set to module´ so every .js` file within will be handled as esm.

So to fix this we need to explicitly name commonjs files .cjs.


I noticed this issue when trying to use @nextcloud/vue 7.6.0 which depends on dialogs version 4.0.0.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Copy link

@mejo- mejo- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can verify that this fixes using @nextcloud/vue 7.6.0.

@ChristophWurst ChristophWurst merged commit b05bb31 into master Feb 16, 2023
@delete-merged-branch delete-merged-branch bot deleted the fix/cjs-projects branch February 16, 2023 09:47
@juliushaertl juliushaertl added the bug Something isn't working label Feb 16, 2023
@juliushaertl
Copy link
Contributor

Thanks @susnux I'll spin a new release

@juliushaertl
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants