Skip to content

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.

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
@juliusknorr juliusknorr added the bug Something isn't working label Feb 16, 2023
@juliusknorr
Copy link
Contributor

Thanks @susnux I'll spin a new release

@juliusknorr
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.

5 participants