-
-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
Running 'react-scripts build' generates Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In ../node_modules/babel-preset-react-app/index.js at Array.map (<anonymous>) #5135
Comments
How are you using Can you provide a small reproducible demo? |
To add more context, I actually had a
I'm going to try and create a project that reproduces the problem. Hopefully I can get it to you within the hour.. |
Create React App doesn’t support configuring Babel in the first place. So it doesn’t matter what you call the file — it is intentionally ignored. Yeah we’d need a demo to tell more. Thanks. |
That detail of not supporting Babel configs in |
@gaearon @Timer -- Here is the link to a repo I made that should reproduce the problem. https://github.com/dsanc89/react-scripts-build-issue Hope it gets recreated successfully on your machines too. |
@dsanc89 Why did you add dependencies like We need to verify 2.x would refuse to build and show a proper error message. |
@gaearon This was an existing project that I inherited so it's hard for me to answer that unfortunately :( It's great to know that including If I were to remove those |
👍 I think 2.x should actually fail with a useful message when this happens. We need to verify this.
Totally, that should help. Remove them from both top-level folder If it doesn't help then let us know what's broken. |
YESSS!! It works!!! You guys are the best! In my case, I only had to remove all babel-related devDependencies (except for Thank you guys so much for your time on this!! |
Is this a bug report?
No. (At least not yet I believe)
Description
So I have a project that was bootstrapped with
create-react-app
. After the passing of time and many commits later, I ended up doing a refactoring that involved restructuring the bootstrapped app. I introduced two more local npm (three including the root folder) modules such that my project folder structure ended up looking like the following:Ever since I did this restructure, running
react-scripts build
produces the following error output:Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. ... at Array.map(<anonymous>)
According to the output, the error is coming from
node_modules/babel-preset-react-app/index.js
which looks like the following:I am using Babel 7 and below is a list of the relevant dependency packages from
package.json
:My
babel.config.js
is the following:I have done as much digging through the internet as I could to try and resolve this problem. Ended up finding many similar posts to this but, none of the suggested solutions worked out for me. I saw one or two that mentioned including the
@babel/preset-env
and@babel/preset-react
presets inbabel.config.js
which I already have. Hoping the community has some insight to share.Environment
Environment:
OS: macOS High Sierra 10.13.6
Node: 8.12.0
Yarn: Not Found
npm: 6.4.1
Watchman: Not Found
Xcode: Not Found
Android Studio: Not Found
Packages: (wanted => installed)
react: ^16.5.2 => 16.5.2
react-dom: ^16.4.0 => 16.5.2
react-scripts: 1.1.5 => 1.1.5
Expected Behavior
'react-scripts build' should build the app with no issues.
Actual Behavior
'react-scripts build' fails.
Reproducible Demo
None yet..
The text was updated successfully, but these errors were encountered: