1

Using a create-react-app setup (i.e. there is no Webpack configuration file in project code) with react-scripts 5.0.1 (as discussed here) and adding dependencies, on every build of my app (including dev-server builds from saving app files) I see lots of warnings from Webpack of the following form:

WARNING in ./node_modules/myDependency/index.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from 'path\to\project\node_modules\myDependency\index.ts' file: Error: ENOENT: no such file or directory, open 'path\to\project\node_modules\myDependency\index.ts'

(This is running on Windows, as an explanation for the funky slash directions there.)

In response to other questions, answers generally recommend adding a GENERATE_SOURCEMAP=false flag, which disables source maps altogether, and they are useful. I would like to continue generating sourcemaps especially for project code, but silence warnings about the lack of source maps in dependencies (i.e. those under /node_modules/).

How do I do that?

While these extra warnings do not prevent the app from working, they may be burying other warnings that are more important and actionable.

WBT
  • 2,249
  • 3
  • 28
  • 40

0 Answers0