-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[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-config or 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 rollup@3.0.0-5. 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 rollup@3.0.0-6. 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 rollup@3.0.0-7. 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 rollup@3.0.0-8. 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 rollup@3.0.0. You can test it via |
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
TRANSPILED_ESM_CONFIG
provides 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
--configPlugin
is 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.mjs
and delete it again after loading.--bundleConfigAsCjs
to force bundling the config to CommonJS instead, even if no--configPlugin
is used. We use the.cjs
extension instead in this case. This also serves as a compatibility mode to e.g. run ESM configs that depend on things like__dirname
.