-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
feat(webpack-plugin): webpack 5 configuration factory #2776
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2776 +/- ##
==========================================
+ Coverage 73.93% 74.03% +0.09%
==========================================
Files 77 78 +1
Lines 2356 2365 +9
Branches 436 437 +1
==========================================
+ Hits 1742 1751 +9
Misses 464 464
Partials 150 150
Continue to review full report at Codecov.
|
const rawConfig = | ||
typeof config === 'string' | ||
? // eslint-disable-next-line import/no-dynamic-require, global-require, @typescript-eslint/no-var-requires | ||
(require(path.resolve(this.projectDir, config)) as Configuration | ConfigurationFactory) |
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.
It would be nice if this were ESM compatible, so that the config file here could be an ESM module (potentially w/ top-level await). I think @MarshallOfSound mentioned a module that will do the work of figuring out whether a file is CommonJS or ESM and "just do the right thing" i.e. require()
or import()
? Or maybe just import()
is enough here?
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.
Tested this out locally, and it seems to be working well. I agree with nornagon above that the ESM compatibility would be nice to have, but if we want to merge this now and start working with it, we can make a tracking issue for that feature 👍
Summarize your changes:
Another take at #1556 for Webpack 5