-
Notifications
You must be signed in to change notification settings - Fork 145
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
Bump os-locale (add support for ESM dependencies) #5415
base: master
Are you sure you want to change the base?
Conversation
@@ -27,7 +28,7 @@ module.exports = { | |||
'^.+\\.js$': 'babel-jest', | |||
'^.+\\.txt$': '<rootDir>/tests/jest-raw-loader.js', | |||
}, | |||
transformIgnorePatterns: ['<rootDir>/node_modules/'], | |||
transformIgnorePatterns: ['<rootDir>/node_modules/(?!os-locale)'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Standard config for ESM packages
// and make the import silently asynchronous. In most cases this breaks the import. | ||
const dependenciesToBundle = [ | ||
'os-locale', // Used exclusively in sync functions | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As expected, there's "no way" to require
a ESM package synchronously. This is not a webpack/config issue. The only way for this to work is to turn addons-linter
into an type=module
package.
So this is the alternative: do not keep os-locale
as an external dependency, so that node does not try to require
it at runtime.
module.exports = { | ||
// Set the webpack4 mode 'none' for compatibility with the behavior of the | ||
// webpack3 bundling step. | ||
mode: 'none', | ||
entry: { | ||
'addons-linter': './src/main.js', | ||
}, | ||
target: 'node', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Webpack defaults to browserlist, if set. We have it already and it's set to node 16
. This enables ESM support
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5415 +/- ##
=======================================
Coverage 98.77% 98.77%
=======================================
Files 51 51
Lines 2855 2855
Branches 867 867
=======================================
Hits 2820 2820
Misses 35 35 ☔ View full report in Codecov by Sentry. |
Ping |
transformIgnorePatterns
correctlyos-locale
v6 has huge savingsv5
v6