Redux-toolkit: Failed to parse source map (v1.6.0)

Created on 9 Jun 2021  路  4Comments  路  Source: reduxjs/redux-toolkit

When I enable inline-source-map in webpack config. A warning was emitted:

WARNING in ../node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '.../node_modules/@reduxjs/toolkit/dist/module.js.map' file: Error: ENOENT: no such file or directory, open '.../node_modules/@reduxjs/toolkit/dist/module.js.map'

All 4 comments

Same here using the source-map-loader v3.0.0 and webpack 5.38.1 with custom webpack configuration.

Can someone put together an example repo that demonstrates this issue?

Here is an example repo.

I started from this boilerplate, the only changes are in this commit.

Running yarn start gives warning Failed to parse source map from...

Hope this helps 馃槃

  1. The Problem is that in the npm package the bundled js code has a wrong "//# sourceMappingURL=" link at the end of the file.
    The not minified ones has "//# sourceMappingURL=module.js.map" and in the minified ones the line is missing.
  2. The source map references an not exiting file "module.ts".

changing sourceMappingUR redux-toolkit.esm.js to "//# sourceMappingURL=redux-toolkit.esm.js.map" and removing the "modules.ts" Ref in the redux-toolkit.esm.js.map and its working again.

Was this page helpful?
0 / 5 - 0 ratings