Repro
https://github.com/jim-king-2000/nextbugrepro
Detail
I create a very simple react component.
const My = () => (<div>ABC</div>);
export default My;
It is in a standalone library project(https://github.com/jim-king-2000/react-module).
Now I use the component in another project.
// index.js
import { My } from 'react-module';
// package.json
"dependencies": {
...
"react-module": "git+https://github.com/jim-king-2000/react-module.git"
}
Then, node.js complains:
error in ./node_modules/react-module/components/My.js
Module parse failed: Unexpected token (1:18)
You may need an appropriate loader to handle this file type.
const My = () => (<div>ABC</div>);
export default My;
./node_modules/react-module/index.js 1:0-32 1:0-32
@ ./pages/index.js
@ multi ./pages/index.js
Question
How to build a ES6 react npm library?