I would like to export multiple files from one file like below.
export default CardNew;
export CardBody from './components/CardBody';
With one default export and other exports. But it is throwing error as "Module build failed: SyntaxError". I have seen people using these type of exports and it works. Or is there any plugin to support these type of exports.
Note: I am using React JS
CardNew has no definition behind it, which is where I suspect your error is coming from.
Try something like:
const CardNew = 'new';
export default CardNew;
export CardBody from './components/CardBody';
Furthermore, ./components/CardBody needs to export CardBody as its default. Otherwise that export expression should be written as
export { CardBody } from './components/CardBody';
Anand KS
Peter Scheler
JS enthusiast
export Name from '...'is not valid JS. You can useexport * from '...',export { default } from '...'orimport Name from '...' export NameSee here for an overview.