[v3.0] Always try to load config files via Node if possible#4621
Conversation
2087c48 to
96e8200
Compare
96e8200 to
d03c069
Compare
d03c069 to
7852afe
Compare
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via npm install rollup/rollup#esm-load-configor load it into the REPL: |
Codecov Report
@@ Coverage Diff @@
## release-3.0.0 #4621 +/- ##
=================================================
+ Coverage 98.97% 98.99% +0.01%
=================================================
Files 211 211
Lines 7428 7439 +11
Branches 2101 2105 +4
=================================================
+ Hits 7352 7364 +12
Misses 23 23
+ Partials 53 52 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
23ff755 to
5f65171
Compare
6d8c3a4 to
06587f3
Compare
06587f3 to
51096cc
Compare
* Support ES modules in bundles config files * Always try to load config files directly if possible * Fix build * Fix test * Debug test
|
This PR has been released as part of [email protected]. Note that this is a pre-release, so to test it, you need to install Rollup via |
* Support ES modules in bundles config files * Always try to load config files directly if possible * Fix build * Fix test * Debug test
|
This PR has been released as part of [email protected]. Note that this is a pre-release, so to test it, you need to install Rollup via |
* Support ES modules in bundles config files * Always try to load config files directly if possible * Fix build * Fix test * Debug test
|
This PR has been released as part of [email protected]. Note that this is a pre-release, so to test it, you need to install Rollup via |
|
This PR has been released as part of [email protected]. Note that this is a pre-release, so to test it, you need to install Rollup via |
* Support ES modules in bundles config files * Always try to load config files directly if possible * Fix build * Fix test * Debug test
|
This PR has been released as part of [email protected]. You can test it via |
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
TRANSPILED_ESM_CONFIGprovides insufficient information #4616Description
As it turns out, bundling a config to CommonJS will not allow users to directly import ESM-only plugins. The solution here is to
--configPlugin--configPluginis used, we bundle to ESM instead of CJS to fix a similar issue with TypeScript configs. To allow loading the bundled config, we temporarily write it to disk with a timestamp in the name and extension.mjsand delete it again after loading.--bundleConfigAsCjsto force bundling the config to CommonJS instead, even if no--configPluginis used. We use the.cjsextension instead in this case. This also serves as a compatibility mode to e.g. run ESM configs that depend on things like__dirname.