next.js: Source map error: Error: Invalid URL: (Firefox)
Bug report
Navigating to our next.js page in Firefox we recieve the following error in the console:
Source map error: Error: Invalid URL: webpack://[name]_[chunkhash]/webpack/bootstrap
Resource URL: http://127.0.0.1:3001/_next/static/development/dll/dll_01ec57fc9b90d43b98a8.js?ts=1574263926643
Source Map URL: dll_01ec57fc9b90d43b98a8.js.map
When investigating the file itself i do see a lot of webpack://[name]_[chunkhash] here are the first few lines: (Im guessing it shouldn’t be like this?)
{"version":3,"file":"dll_01ec57fc9b90d43b98a8.js","sources":["webpack://[name]_[chunkhash]/webpack/bootstrap","webpack://[name]_[chunkhash]/./node_modules/object-assign/index.js","webpack://[name]_[chunkhash]/./node_modules/prop-types/checkPropTypes.js","webpack://[name]_[chunkhash]/./node_modules/prop-types/lib/ReactPropTypesSecret.js","webpack://[name]_[chunkhash]/./node_modules/react-dom/cjs/react-dom.development.js","webpack://[name]_[chunkhash]/./node_modules/react-dom/index.js","webpack://[name]_[chunkhash]/./node_modules/react/cjs/react.development.js","webpack://[name]_[chunkhash]/./node_modules/react/index.js","webpack://[name]_[chunkhash]/./node_modules/scheduler/cjs/scheduler-tracing.development.js","webpack://[name]_[chunkhash]/./node_modules/scheduler/cjs/scheduler.development.js","webpack://[name]_[chunkhash]/./node_modules/scheduler/index.js","webpack://[name]_[chunkhash]/./node_modules/scheduler/tracing.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules
To Reproduce
- Run next watch
- Navigate to next in Firefox
- Open dev tools
Screenshots

System information
- OS: MacOS 10.14.6
- Browser: Firefox Developer Edition (71.0b10)
- Version of Next.js: 9.1.3
Additional context
This only seems to be affecting Firefox, Chrome reports no issues in the console
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 21
- Comments: 19 (5 by maintainers)
Given the
sourcesvalues, I think this error is expected, becausewebpack://[name]_[chunkhash]/webpack/bootstrapis indeed an invalid URL. Since it is://, the value after it is a hostname, e.g.mozilla.comor whatever. URLs define a initial[at the beginning to indicate a URL that is an IPv6 address, e.g.webpack://[1::1]. Given thatnameandchunkhashhere are clearly a bug, let’s move on to that:This seems to be either a bug in https://github.com/asfktz/autodll-webpack-plugin, which Next is using, or a bug in Webpack itself.
autodllcreates DLLs with a global library with"[name]_[chunkhash]"as the name of the DLL and the name of the library.I’m guessing it’s the second one that’s the problem, though it’s hard to tell. The docs for
DllPlugin’snameargument say it accepts template replacements for[name]and[hash](though I think[chunkhash]is probably also assumed to work there?). However, the docs foroutput.librarymake no such mention. And since sourcemaps are generated usingoutput.devtoolModuleFilenameTemplate’s default ofwebpack://[namespace]/[resource-path]?[loaders]and those same docs say[namespace]is “The modules namespace. This is usually the library name when building as a library, empty otherwise”, it sounds likeautodllis expecting Webpack to place[name]and[chunkhash]in the library name whereas Webpack’s docs don’t suggest that it is supposed to do that.We dropped
autodll-webpack-pluginand switched to a Firefox-preferreddevtooloption. These changes were made over multiple PRs so it’d be hard to track down exact links.I’ve been hitting this issue in the Firefox dev console (not while using vscode for debugging). Is there guidance on fixing the mappings there?
https://github.com/asfktz/autodll-webpack-plugin looks to be deprecated and is recommending https://github.com/mzgoddard/hard-source-webpack-plugin until Webpack 5.0 comes out
Up to date reproduction steps:
You should see :
cc @Timer I wonder if you have more context here.
@jasonLaster yes it does i can reproduce this in the next.js examples:
Steps
launch.jsonfile with this content https://gist.github.com/jasonwilliams/417920a7bb231e853c6e0521621c4e3dnpm run dev