deepcopy.js icon indicating copy to clipboard operation
deepcopy.js copied to clipboard

ReferenceError: require is not defined (create-react-app v2.0)

Open sartaj10 opened this issue 6 years ago • 1 comments

Hi,

I recently upgraded my project to use the create-react-app v2.0 and I'm getting this error

screen shot 2018-10-19 at 10 51 32 am

The issue seems to be around the fact that with this update, they have removed support for .mjs extensions as seen below

screen shot 2018-10-19 at 10 53 18 am

Here are a couple of links that I found that seem to fix the problem for other packages https://github.com/facebook/create-react-app/pull/4318 https://github.com/jaredpalmer/razzle/commit/39ea3a6b05608cb686c8c2c85f107a92013476d9#diff-4fc6a7be00756e3dbc6b0eac82ea10e5R145

NOTE : This worked fine with create-react-app V1.0

sartaj10 avatar Oct 19 '18 17:10 sartaj10

Related: I'm getting the error:

ERROR in ./node_modules/deepcopy/index.mjs
Module not found: Error: Can't resolve './src/index' in '/Users/[...]/webapp/node_modules/deepcopy'```

dmt0 avatar Nov 01 '18 18:11 dmt0