I have react component to be used in emberJS, this is what I was doing. First, I need to install react and react-dom in package json, so I added this:
“dependencies”: { “react”: “^16.2.0”, “react-dom”: “^16.2.0”, “webpack”: “^1.15.0” },
then I run npm install,
then in the component, I want to import react and react-dom,
import React from ‘react’; import ReactDOM from ‘react-dom’;
but when I am refresh the UI, I got this error:
Uncaught Error: Could not find module react
imported from ember-quickstart/components/people-list
at missingModule (loader.js:247)
at findModule (loader.js:258)
at Module.findDeps (loader.js:168)
at findModule (loader.js:262)
at requireModule (loader.js:24)
at Class._extractDefaultExport (index.js:392)
at Class.resolveOther (index.js:113)
at Class.superWrapper [as resolveOther] (ember-utils.js:418)
at Class.resolve (resolver.js:133)
at _resolve (container.js:886)
This is a very normal approaches for introducing any external npm package, why it failed?
Please help to share your opinions for this.
Thanks