timarney / react-app-rewired

Override create-react-app webpack configs without ejecting
MIT License
9.77k stars 425 forks source link

Exporting Aggregated modules fails: Module parse failed: Unexpected token #558

Closed machariamuguku closed 2 years ago

machariamuguku commented 3 years ago

If a package exports aggregated modules like so: export * as foo from './bar' the react-app-rewired start command fails with the following error:

Module parse failed: Unexpected token
File was processed with these loaders:
* ../node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
machariamuguku commented 3 years ago

PS: Temporary solution is to re-export module explicitly like so:

import * as foo from './bar'
export { foo }
mhsueh-xealth commented 2 years ago

I fixed this by adding this plugging: proposal-export-default-from to my babel config.

timarney commented 2 years ago

Closing this given no recent activity.