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

image

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)

Most upvoted comments

Given the sources values, I think this error is expected, because webpack://[name]_[chunkhash]/webpack/bootstrap is indeed an invalid URL. Since it is ://, the value after it is a hostname, e.g. mozilla.com or whatever. URLs define a initial [ at the beginning to indicate a URL that is an IPv6 address, e.g. webpack://[1::1]. Given that name and chunkhash here 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. autodll creates 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’s name argument say it accepts template replacements for [name] and [hash] (though I think [chunkhash] is probably also assumed to work there?). However, the docs for output.library make no such mention. And since sourcemaps are generated using output.devtoolModuleFilenameTemplate’s default of webpack://[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 like autodll is 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-plugin and switched to a Firefox-preferred devtool option. 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?

Up to date reproduction steps:

You should see : image

cc @Timer I wonder if you have more context here.

@jasonLaster yes it does i can reproduce this in the next.js examples:

Steps

  • Checkout next.js (i checked out master - d90c85311140b8a55d611dd5cc4fd15e30f7e708)
  • in the vscode directory, add a launch.json file with this content https://gist.github.com/jasonwilliams/417920a7bb231e853c6e0521621c4e3d
  • Navigate to examples/blog-starter
  • npm install in this directory.
  • npm run dev
  • In VSCode launch debugger “Firefox - NextJS”
  • Once firefox is opened, look in the dev tools console