Reputation: 2529
I am trying to move a React app into Create-React-App but struggling to get some things to work and not really knowing what is and what isn't allowed (regarding customisation and adding extra modules) with Create-React-App.
Currently the CRA with the source from the React app is failing to compile at:
export App from "./App/App"
With error:
./src/containers/index.js
SyntaxError: /Volumes/Mexico/Workspace/create-react-app-test/myapp/src/containers/index.js: Support for the experimental syntax 'exportDefaultFrom' isn't currently enabled (1:8):
Add @babel/plugin-proposal-export-default-from (https://git.io/vb4yH) to the 'plugins' section of your Babel config to enable transformation.
I don't wish to eject from CRA and I don't believe I can change the Babel configuration so I am not sure what to do.
Is this syntax supported in CRA? If so, what should I do to get it to work. If not, do I have to rewrite all the code?
react-scripts 2.1.8 node v11.14.0 npm 6.9.0
Thanks, Ashley.
Upvotes: 1
Views: 968
Reputation: 222989
export App from "./App/App"
is not among supported export
syntax variations.
In order to be spec-compliant, it can be changed to:
export { default as App } from "./App/App"
Upvotes: 3
Reputation: 3108
You can do something like
export {default as App} from './App/App';
export {default as About} from './About/About';
.
.
.
Upvotes: 1