Skip to content
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

Add support for config.rollup.mjs/ESM configs #179

Merged
merged 1 commit into from
Feb 19, 2021
Merged

Add support for config.rollup.mjs/ESM configs #179

merged 1 commit into from
Feb 19, 2021

Conversation

adamburgess
Copy link
Contributor

Rollup supports mjs/cjs/js extensions for the config:

# if you do not pass a file name, Rollup will try to load
# configuration files in the following order:
# rollup.config.mjs -> rollup.config.cjs -> rollup.config.js

So this adds support for that.

The change in cli.js searches for mjs/cjs with a fallback to .js (code copied from rollup)
The change in impl/ConfigLoader.js uses import when a file ends with mjs, instead of compiling and requiring.
A little extra work is needed for importing the mjs file on windows due to it needing urls and not paths: nodejs/node#34765

I would add tests but... it doesn't seem like the cli is tested. I could add an example project instead.

@PepsRyuu
Copy link
Owner

Thanks! Will give it a try as soon as I can. :)

@PepsRyuu PepsRyuu merged commit 900cb71 into PepsRyuu:master Feb 19, 2021
@PepsRyuu
Copy link
Owner

Released in 0.15.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants