published npm package warning Fix

Issue

I published my first package using npm. However, when I import it in Codesandbox it gives me a warning

Error when converting '/node_modules/protected-react-routes-generators/src/index.js' esmodule to commonjs: Cannot read property 'type' of null

This is my github Repo

Also when i installed it from NPM, it gives me this error
enter image description here

I don’t know what this error is, any clue ?
Thanks!

Solution

Babel can’t compile jsx extensions. Install:

npm install --save-dev @babel/preset-react

And add to your .babelrc file:

{"presets": ["@babel/preset-react"]}

Answered By – Paul Barrié

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published