Loading preexisting source map: "Unexpected token"
See original GitHub issueI’m trying to load a preexisting source map using:
rules: [
{test: /\.js$/, use: "source-map-loader", enforce: "pre"}
]
Unfortunately, I’m getting this warning:
WARNING in ./modules/MyFile.js.map
Module parse failed: /Users/me/MyFile.js.map Unexpected token (1:10)
You may need an appropriate loader to handle this file type.
| {"version":3,"file":"MyFile.js","sourceRoot":"","sources":["components/MyFile.tsx"],"names":[],"mappings":"AAAA,qCAAqC;;;;;;;;;;;;;AAErC,[...],GA2BnD"}
The source map was originally built by the TypeScript compiler. But in my opinion, this shouldn’t matter, since it is a standardized format and source-map-loader
should probably not have a problem with that.
I’m using the latest stable of Webpack (2.3.3) as well as the latest stable of source-map-loader (0.2.1).
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
gulp-sourcemaps, Uncaught SyntaxError: Unexpected token
A sourcemap is a json object. You should load them properly; although Chrome knows it is a sourcemap and will treat it as...
Read more >Node.js v19.3.0 Documentation
Building; Linking to libraries included with Node.js; Loading addons using require() ... The Module object; Source map v3 support ... parseArgs tokens.
Read more >DevTools failed to load source map - Microsoft Q&A
Per my research you could try to uncheck "Enable JavaScript source maps" in developer tools settings. Press F12 > Settings > Uncheck "Enable ......
Read more >Debugging — Emscripten 3.1.26-git (dev) documentation
Compiler debug information flags that allow you to preserve debug information in compiled code and even create source maps so that you can...
Read more >Adding Google Maps to a Flutter app - Google Codelabs
In this codelab, you'll build a Google Maps experience using the Flutter mobile app SDK for crafting high-quality native experiences on iOS ...
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
@kraftwer1 I had same issue, and solve it.
It is not occured by source-map-loader. This problem was occured this problem by pure webpack config, not include devtool, source-loader etc… I think almost webpack/typescript user using ts-loader.
Solution
I am using
ignore-loader
see https://stackoverflow.com/a/39886771/1960600Now, I can debug with source-map what typescript generate. And webpack not showing
WARNING ~~ Unexpected token
Oh okay.