{"action":"opened","issue":{"url":"https://api.github.com/repos/facebook/create-react-app/issues/5135","repository_url":"https://api.github.com/repos/facebook/create-react-app","labels_url":"https://api.github.com/repos/facebook/create-react-app/issues/5135/labels{/name}","comments_url":"https://api.github.com/repos/facebook/create-react-app/issues/5135/comments","events_url":"https://api.github.com/repos/facebook/create-react-app/issues/5135/events","html_url":"https://github.com/facebook/create-react-app/issues/5135","id":364490465,"node_id":"MDU6SXNzdWUzNjQ0OTA0NjU=","number":5135,"title":"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>)","user":{"login":"dsanc89","id":4277756,"node_id":"MDQ6VXNlcjQyNzc3NTY=","avatar_url":"https://avatars1.githubusercontent.com/u/4277756?v=4","gravatar_id":"","url":"https://api.github.com/users/dsanc89","html_url":"https://github.com/dsanc89","followers_url":"https://api.github.com/users/dsanc89/followers","following_url":"https://api.github.com/users/dsanc89/following{/other_user}","gists_url":"https://api.github.com/users/dsanc89/gists{/gist_id}","starred_url":"https://api.github.com/users/dsanc89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsanc89/subscriptions","organizations_url":"https://api.github.com/users/dsanc89/orgs","repos_url":"https://api.github.com/users/dsanc89/repos","events_url":"https://api.github.com/users/dsanc89/events{/privacy}","received_events_url":"https://api.github.com/users/dsanc89/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-27T13:59:41Z","updated_at":"2018-09-27T13:59:41Z","closed_at":null,"author_association":"NONE","body":"### Is this a bug report?\r\n\r\nNo. (At least not yet I believe)\r\n\r\n### Description\r\n\r\nSo 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:\r\n\r\n    -- root project folder (also an npm package)\r\n        -- local npm module1\r\n        -- local npm module2\r\n        -- create-react-app module\r\n\r\nEver since I did this restructure, running `react-scripts build` produces the following error output:\r\n\r\n`Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. ... at Array.map(<anonymous>)`\r\n\r\nAccording to the output, the error is coming from `node_modules/babel-preset-react-app/index.js` which looks like the following:\r\n\r\n    'use strict';\r\n\r\n    const create = require('./create');\r\n    var env = process.env.BABEL_ENV || process.env.NODE_ENV;\r\n\r\n    module.exports = create(env);\r\n\r\nI am using Babel 7 and below is a list of the relevant dependency packages from `package.json`:\r\n\r\n    \"dependencies\": {\r\n        ...\r\n        \"react\": \"^16.5.2\",\r\n        \"react-dom\": \"^16.4.0\",\r\n        \"react-loadable\": \"^5.4.0\",\r\n        \"react-router-dom\": \"^4.3.1\",\r\n        \"react-scripts\": \"1.1.5\"\r\n    },\r\n    \"devDependencies\": {\r\n        \"@babel/cli\": \"^7.1.0\",\r\n        \"@babel/core\": \"^7.1.0\",\r\n        \"@babel/preset-env\": \"^7.1.0\",\r\n        \"@babel/preset-flow\": \"^7.0.0\",\r\n        \"@babel/preset-react\": \"^7.0.0\",\r\n        \"babel-core\": \"^7.0.0-bridge.0\",\r\n        \"babel-eslint\": \"^9.0.0\"\r\n        ...\r\n    }\r\n\r\nMy `babel.config.js` is the following:\r\n\r\n    module.exports({\r\n     presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-flow']\r\n    })\r\n\r\nI 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 in `babel.config.js` which I already have. Hoping the community has some insight to share.\r\n\r\n### Environment\r\n\r\nEnvironment:\r\n  OS:  macOS High Sierra 10.13.6\r\n  Node:  8.12.0\r\n  Yarn:  Not Found\r\n  npm:  6.4.1\r\n  Watchman:  Not Found\r\n  Xcode:  Not Found\r\n  Android Studio:  Not Found\r\n\r\nPackages: (wanted => installed)\r\n  react: ^16.5.2 => 16.5.2\r\n  react-dom: ^16.4.0 => 16.5.2\r\n  react-scripts: 1.1.5 => 1.1.5\r\n\r\n### Expected Behavior\r\n\r\n'react-scripts build' should build the app with no issues.\r\n\r\n\r\n### Actual Behavior\r\n\r\n'react-scripts build' fails.\r\n\r\n### Reproducible Demo\r\n\r\nNone yet.."}}
{"actor":{"display_login":"dsanc89"}}