I am creating a React component and want to publish it.
I installed package.json
:
"peerDependencies": {
"react": "^15.6.1",
"react-dom": "^15.6.1"
},
And expect that when creating my module using webpack my component will not yell at this:
Module not found: Error: Can't resolve 'react'
How can I compile a production component without including React?
I checked a few famous ones:
react-select
react-toggle
And they only list the reaction in peerDependecies (and in devDependecies, for testing and development, I think) If I add an answer to my devDeps and run it webpack -p
, it compiles successfully, but then I have react
components in my kit.
Here is my simple web package setup
What am I missing?
UPDATE
"" webpack ( gist), , React , React , :
"" undefined
React.Component
...