Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

.babelrc.js export function does not work #122

Closed
trickpattyFH20 opened this issue Jan 8, 2021 · 3 comments
Closed

.babelrc.js export function does not work #122

trickpattyFH20 opened this issue Jan 8, 2021 · 3 comments

Comments

@trickpattyFH20
Copy link

.rescriptsrc.js

module.exports = [
  ['use-babel-config', '.babelrc.js'],
];

.bablerc.js export object (works)

module.exports = {
  "presets": ["@babel/preset-env", "@babel/preset-react"],
  "plugins": ["transform-react-qa-classes"],
  "env": {
    "test": {
    }
  }
}

.babelrc.js export function (does not work)

module.exports = (api) => {
  const config = {
    "presets": ["@babel/preset-env", "@babel/preset-react"],
    "plugins": ["transform-react-qa-classes"],
    "env": {
      "test": {
      }
    }
  };

  return config;
}
@harrysolovay
Copy link
Owner

Have you tried wrapping the function in braces?

- module.exports = (api) => {
+ module.exports = [(api) => {
  const config = {
    "presets": ["@babel/preset-env", "@babel/preset-react"],
    "plugins": ["transform-react-qa-classes"],
    "env": {
      "test": {
      }
    }
  };

  return config;
- }
+ }]

@trickpattyFH20
Copy link
Author

@harrysolovay wrapping it in array also does not work
I get Error: Unknown option: .0.

@harrysolovay
Copy link
Owner

Ahhh well here's why––you're not meant to return a Babel config, you're meant to return either a Webpack config or a rescript. Please refer to the documentation.

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

No branches or pull requests

2 participants