Failed to parse source map from [path] warning
See original GitHub issue- Operating System: macOS Catalina
10.15.6
- Node Version:
12.18.2
- NPM Version:
6.14.5
- Yarn version:
1.22.4
- webpack Version:
4.43.0
- source-map-loader version:
1.0.1
Actual Behavior
Failed to parse source map from [path] file: Error: ENOENT: no such file or directory, open [path]
warnings are logged in the terminal (as well in the browser console log).
Remarks
- It failed to load all
standardized-audio-context
package source map files - Seems that
source-map-loader
treats the path//# sourceMappingURL=/build/es2019/constants.js.map
as an absolute path, what cause the failureError: ENOENT: no such file or directory
- For my test, removing the prefixed slash
/
from the path/build/es2019/constants.js.map
fixes the issue, so:
// not work 😢
//# sourceMappingURL=/build/es2019/constants.js.map
// work 😍
//# sourceMappingURL=build/es2019/constants.js.map
Expected Behavior
No Failed to parse source map from...
warnings should logged in the terminal and in the browser console log.
Code
{
test: /\.js$/,
enforce: 'pre',
use: ['source-map-loader'],
},
Example of how the sourceMappingURL
directive that fails looks like:
//# sourceMappingURL=/build/es2019/constants.js.map
How Do We Reproduce?
Prerequisite
Web app project that make use of source-map-loader
Steps
- Install
standardized-audio-context
package - Import any module from
standardized-audio-context
into a*.js/*.ts
file - Start/build the project
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Webpack Module Warning: Failed to parse source map from ...
If you're experiencing this issue with react-scripts /cra version 5.0.0 . You'll need to add the following to your .env file.
Read more >webpack 5: Failed to parse source map from "@mswjs ...
I'm seeing these warnings when starting the dev server using react-scripts start , If i exclude the above config by setting GENERATE_SOURCEMAP= ...
Read more >Failed to parse source map warnings - Dynamic Docs
If using create-react-app v5, you may see some warnings (although they appear like errors) when running/building your react application. This has been reported ......
Read more >source-map-loader - webpack
Extracts source maps from existing source files (from their sourceMappingURL ). Getting Started. To begin, you'll need to install source-map-loader : npm i ......
Read more >upgrading to webpack 5 causes sourcemap issues : r/typescript
As it is a component library, I am getting a warning for every file but ... node_modules/source-map-loader/dist/cjs.js): Failed to parse ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@shimizacken yes, let’s open an issue and wait an answer, if they will not fix it, I will think about it deeply, and provide fallback for this cases
@shimizacken I investigate this issue and I’m afraid to say that we cannot fix it,
sourceMappingURL
is strange:In file
node_modules/standardized-audio-context/build/es2019/factories/native-constant-source-node-factory.js
it is relative to package root, but we don’t know it is package or not, this would require additional logic that would decrease performance dramatically.
Right
sourceMappingURL
:Ideally it should be always relative to file, not to directory/package root or other contexts