ncc
ncc copied to clipboard
fix(cjs-build): enable evaluating import.meta in cjs build
Purpose
A while ago, a PR was merged to disable import.meta evaluation altogether to support new versions of Webpack. This sometimes causes issues in CJS projects.
In the comments, there were some discussions about whether we should have a conditional and keep the previous behavior for CJS builds. This PR addresses exactly this by putting back compile-time evaluation of import.meta.url
I have created a comparative build between two projects using the same code and a dependency (@sentry/node) that uses import.meta.url. You can see the difference in the output index.js
Before the change:
After:
Closes #1019