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

Error when babel.config.js is ESM _and_ in the same directory as where rollup is executed from. #167

Closed
NullVoxPopuli opened this issue Feb 1, 2022 · 1 comment

Comments

@NullVoxPopuli
Copy link

NullVoxPopuli commented Feb 1, 2022

  • Version: 2.0.5
  • Rollup Version: 2.66.0
  • Operating System and version (if applicable): Linux/Ubuntu 20.04
  • Node Version (if applicable): 16.13.1
  • Does it work with tsc (if applicable): yes

Reproduction

  1. define babel.config.js as ESM in a package with type="module" (this step is optional)
  2. define rollup config:
    import babelConfig from './babel.config';
    
      ts({
        transpiler: 'babel',
        browserslist: false,
        babelConfig, // set here
      }),
  3. run rollup -c
  4. observe error:
    Error while loading config - You appear to be using a native ECMAScript module configuration file, which is only supported when running Babel asynchronously.
    

Expected Behavior

No error

Actual Behavior

Error.

What's funny is if I move the babel.config to a different directory, (like config or something), the error goes away.

So it seems that even though I'm setting babelConfig, the ts plugin is still trying to read babel.config.js itself

@wessberg
Copy link
Owner

wessberg commented Jun 7, 2022

Hey there. Thanks for making me aware of this. I've added support for ESM-based Babel configs in v3.0.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

No branches or pull requests

2 participants