-
Notifications
You must be signed in to change notification settings - Fork 287
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
Error when mixing ESM and CJS #749
Comments
This would be a Webpack semantic in how webpack builds CommonJS. One of the things to note is that So a question to understand further would be - what is the use case you have in mind here that you're looking to handle? Then we can discuss ways to approach that use case rather. |
In my case, I worked around it by replacing |
Was the generated file an ES module or a CJS module? |
The generated file was a CJS module - it was created by sequelize-cli as part of creating a database migration. For reference, here's the original file generated by sequelize-cli: |
So basically, we only rewrite When building into CommonJS we do exactly the same thing, but At the end of the day this is about use cases... I would be surprised if the use case was working with the naive CJS version anyway. Again, regardless of outcome - this is a Webpack concern not an ncc concern. I've posted webpack/webpack#14072 to track further. |
any news on this? |
It looks like webpack/webpack#14072 was finally merged and released in The PR to upgrade webpack (#1158) is currently failing CI so if anyone wants to fix it, I can take a look, thanks! |
This breaks ncc / node because of __dirname use Maybe try again when this issue is closed: vercel/ncc#749
transfer to #1177 |
This issue still seems relevant. |
In a project with
"type": "module"
in the package.json that also contains.cjs
files, the.cjs
files cannot access the global variables__filename
,__dirname
, etc that should be available to commonjs files.I've created https://github.com/joeldenning/ncc-mixed-modules to demonstrate the problem.
The text was updated successfully, but these errors were encountered: