Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

error with sourcemaps #68

dancespiele opened this issue Nov 9, 2017 · 36 comments

error with sourcemaps #68

dancespiele opened this issue Nov 9, 2017 · 36 comments


Copy link

dancespiele commented Nov 9, 2017

I reproduce this issue when I use source maps with this plugin.
My config file:

const path = require('path')
const webpack = require("webpack");
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MinifyPlugin = require("babel-minify-webpack-plugin");

module.exports = {
	entry: path.resolve(__dirname, './app/component/index'),
    devtool: 'source-map',
	output: {
		path: path.resolve(__dirname, './dist'),
		filename: 'app.bundle.js'

	resolve: {
		extensions: ['.ts', '.tsx', '.js', '.jsx']

	module: {
		rules: [{
			test: /\.tsx?$/,
			exclude: /node_modules/,
			loaders: ['ts-loader']
		}, {
			test: /\.css$/,
			include: /node_modules/,
			loaders: ['style-loader', 'css-loader']
		}, {
			test: /\.scss$/,
			use: [{
				loader: "style-loader"
			}, {
				loader: "css-loader"
			}, {
				loader: "sass-loader"
		}, {
			test: /\.(eot|svg|ttf|woff|woff2)$/,
			loaders: ['file-loader?name=fonts/[name].[ext]']
    plugins: [
        new MinifyPlugin()

The error which I get is this:

        throw new Error(

Error: original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.
    at SourceMapGenerator_validateMapping [as _validateMapping] (/home/razorpack/develop/pyrite-prism/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:276:15)
    at SourceMapGenerator_addMapping [as addMapping] (/home/razorpack/develop/pyrite-prism/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:110:12)
    at /home/razorpack/develop/pyrite-prism/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:72:17
    at Array.forEach (<anonymous>)
    at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (/home/razorpack/develop/pyrite-prism/node_modules/webpack-sources/node_modules/source-map/lib/source-map-consumer.js:157:14)
    at Function.SourceMapGenerator_fromSourceMap [as fromSourceMap] (/home/razorpack/develop/pyrite-prism/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:48:24)
    at SourceMapSource.node (/home/razorpack/develop/pyrite-prism/node_modules/webpack-sources/lib/SourceMapSource.js:32:35)
    at SourceMapSource.proto.sourceAndMap (/home/razorpack/develop/pyrite-prism/node_modules/webpack-sources/lib/SourceAndMapMixin.js:30:18)
    at getTaskForFile (/home/razorpack/develop/pyrite-prism/node_modules/webpack/lib/SourceMapDevToolPlugin.js:33:30)
    at chunk.files.forEach.file (/home/razorpack/develop/pyrite-prism/node_modules/webpack/lib/SourceMapDevToolPlugin.js:91:21)
    at Array.forEach (<anonymous>)
    at /home/razorpack/develop/pyrite-prism/node_modules/webpack/lib/SourceMapDevToolPlugin.js:89:18
    at Array.forEach (<anonymous>)
    at Compilation.<anonymous> (/home/razorpack/develop/pyrite-prism/node_modules/webpack/lib/SourceMapDevToolPlugin.js:88:12)
    at Compilation.applyPlugins1 (/home/razorpack/develop/pyrite-prism/node_modules/tapable/lib/Tapable.js:75:14)
    at self.applyPluginsAsync.err (/home/razorpack/develop/pyrite-prism/node_modules/webpack/lib/Compilation.js:670:11)
    at next (/home/razorpack/develop/pyrite-prism/node_modules/tapable/lib/Tapable.js:202:11)
    at Compilation.<anonymous> (/home/razorpack/develop/pyrite-prism/node_modules/babel-minify-webpack-plugin/dist/index.js:119:11)
    at Compilation.applyPluginsAsyncSeries (/home/razorpack/develop/pyrite-prism/node_modules/tapable/lib/Tapable.js:206:13)
    at self.applyPluginsAsync.err (/home/razorpack/develop/pyrite-prism/node_modules/webpack/lib/Compilation.js:666:10)
    at Compilation.applyPluginsAsyncSeries (/home/razorpack/develop/pyrite-prism/node_modules/tapable/lib/Tapable.js:195:46)
    at sealPart2 (/home/razorpack/develop/pyrite-prism/node_modules/webpack/lib/Compilation.js:662:9)
    at Compilation.applyPluginsAsyncSeries (/home/razorpack/develop/pyrite-prism/node_modules/tapable/lib/Tapable.js:195:46)
    at Compilation.seal (/home/razorpack/develop/pyrite-prism/node_modules/webpack/lib/Compilation.js:605:8)
    at applyPluginsParallel.err (/home/razorpack/develop/pyrite-prism/node_modules/webpack/lib/Compiler.js:508:17)
    at /home/razorpack/develop/pyrite-prism/node_modules/tapable/lib/Tapable.js:289:11
    at _addModuleChain (/home/razorpack/develop/pyrite-prism/node_modules/webpack/lib/Compilation.js:507:11)
    at processModuleDependencies.err (/home/razorpack/develop/pyrite-prism/node_modules/webpack/lib/Compilation.js:477:14)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
npm ERR! errno 1
npm ERR! pyrite-bootstrap@0.0.1 production: `webpack --config ./webpack.production.config.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the pyrite-bootstrap@0.0.1 production script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/razorpack/.npm/_logs/2017-11-09T19_15_16_251Z-debug.log

When I use the source maps without this plugin it works fine.
The version plugin is: 0.2.0

Copy link

Could you try to provide a small repo with a file/module where this error occurs ? I'm currently debugging this and a failing example would be quite helpful :)

Copy link

dancespiele commented Nov 10, 2017

Sure @michael-ciniawsky, this is the repository . You have to install as global nodemon and typescript. To reproduce the fail you need to execute npm run production

Copy link

In particular, I found cheap-* source maps work, e.g. module-source-map dies, while cheap-module-source-map does not.

Copy link

ingro commented Dec 4, 2017

Got the same problem, using cheap-source-map instead of source-map doesn't throw error though.

Copy link

timwis commented Dec 5, 2017

Just want to chime in that this is happening to me too. Ref webpack/webpack#5931

For those unfamiliar with cheap-source-map, here's some docs:

Copy link

Running git bisect on this turns up the following commit:

❯ git bisect good
d0a724cec766ea5fbea9ecc514d38f7fd2ee3735 is the first bad commit
commit d0a724cec766ea5fbea9ecc514d38f7fd2ee3735
Author: Joshua Wiens <>
Date:   Sat Aug 12 02:50:01 2017 -0500

    refactor: Apply webpack-defaults (#51)

    * refactor: Init webpack-defaults
    * style: Update for defaults
    * chore: Remove legacy babel env setting
    * chore: Update repo & bugs in pacakge.json
    * test: Fix source map test assertion syntax

    BREAKING CHANGE: Enforces `engines` of `"node": ">=4.3.0 < 5.0.0 || >= 5.10`
    BREAKING CHANGE: Enforces `peerDependency` of `"webpack": "^2.0.0 || ^3.0.0`

:100644 100644 354caa95dfed982fff17dafbe378e1b253fdbdba e7e4dbd99b91e6c699aeecd4e21b72594c00093e M	.babelrc
:100644 100644 1a096400cea55f9c0bfd7abb3da880c31ffce53d 1f899991b1335c3b8fc09a137fa5e6269bb2b65e M	.editorconfig
:000000 100644 0000000000000000000000000000000000000000 b2d59d1f7578b05e96f3b3f8a7d5039df3d06fb6 A	.eslintignore
:000000 100644 0000000000000000000000000000000000000000 4016c3eed18c749c8d968ccf89ce374bbb611842 A	.eslintrc
:100644 000000 d98f68986934414fd629c5a9774bcb810a4bf237 0000000000000000000000000000000000000000 D	.eslintrc.js
:000000 100644 0000000000000000000000000000000000000000 b07091b9b12ca11a84f562f56cdb4156712280be A	.gitattributes
:000000 040000 0000000000000000000000000000000000000000 7094ba2f4446b63099d07d17b7663d5412d01a74 A	.github
:100644 100644 8a05de541c440248984dc2b58407e2a327875b31 de347064f4986dab4d1133dc79dde317f7d48c7b M	.gitignore
:100644 100644 ddccd23750a34fbd08773ef6a2d7615c6137835c 76b149227e1523aaecc5a129652073d922571d6d M	.travis.yml
:000000 100644 0000000000000000000000000000000000000000 95fd7360e907a3797f16dcef7b00d4b138d4ca06 A
:000000 100644 0000000000000000000000000000000000000000 aa4f18a5043eac562724cbfd7f2ec1f5b7764b77 A	appveyor.yml
:000000 100644 0000000000000000000000000000000000000000 0dde8ba5af5e47cfa7fdf40e444f986ac3d6db2c A	package-lock.json
:100644 100644 cce2507527c11f4a2e0f1e4e44d1035dae31da0c 9bb3ec1bb62095452e50c3e4379092b566a6fa4b M	package.json
:040000 040000 908bc17c9eaea633e6821e219a4ca213d945cdd4 e3c1dacbbd18feab5b4451ac516841134d14d79f M	src
:040000 040000 5dc5817b66f78e6ea66ccd3e51410b03f1e1753e 82c3316b8e07d066761dd89486d54ba1ef656838 M	test
:100644 000000 b36b79094e0678df41773b4ed923b7c561459e44 0000000000000000000000000000000000000000 D	yarn.lock

Copy link

Also having this problem with the 'source-map' option.

Copy link

nealoke commented Dec 16, 2017

Just wanted to chip in and say that in my case it doesn't matter if i use the BabiliPlugin() or not, as long as I don't have the "webpack-sources": "1.0.1" installed it always fails.

Also wanted to provide you with my files used:


  • npm run server -> no error
  • npm run server:test -> error (if webpack-sources@1.0.1 is not explicitly installed)
  • npm run build:prod -> no error

Copy link

I'm running into the same problem. I worked around it by pinning babili-webpack-plugin to 0.1.1.

cf. webpack/webpack#5931 (comment)

Copy link

So what's going on here? It seems like a breaking commit has been identified and that, most of the time, cheap-* avoids the problem while others don't. Do we need more repro examples?

Copy link

I'd guess cheap-* "fixing" it is since IIRC that disables minification source mapping (not much point mapping line-by-line if you only output one line!), but that doesn't narrow it down much. Seems there are plenty of references to this, so probably plenty of repro cases, just needs someone to spend the time on it.

Copy link

arbaaz commented Jan 4, 2018

I'm also facing this issue.

Copy link

alexander-akait commented Feb 2, 2018

Problem still exists? If yes please create minimum reproducible test repo. Thanks!

Copy link

arbaaz commented Feb 2, 2018

I commented out BabiliPlugin and it was working.

// new BabiliPlugin()

Copy link

@arbaaz Incredible solution :trollface:

Copy link

tarjei commented Feb 2, 2018

I feel a bit bad about saying this, but I changed to Uglify-es and got very good results both wrt to compilation speed and sourcemaps.

Copy link

@tarjei i near future i implement cache and parallels, first we need fix bugs

Copy link

tarjei commented Feb 2, 2018

@evilebottnawi 👍

Copy link

ghost commented Feb 5, 2018

I have the similiar problem, and here is demo.

edmorley added a commit to neutrinojs/neutrino that referenced this issue Apr 24, 2018
It was required to work around a source map bug when using newer
`webpack-sources` with `babel-minify-webpack-plugin`:

However now that we're using `uglify-es` instead, we can stop pinning
the `webpack-sources` version and pick up some of the bug/perf fixes:
Copy link

jbelien commented Sep 6, 2018

Any fix / workaround available for this issue ?

Temporarily disabling sourcemaps with config.devtool = false until solution is found.

I did the same but it's a bit unfortunate ...

jbelien added a commit to geo6/document-manager that referenced this issue Sep 6, 2018
Disable source-map for production due to issue with Babel plugin.
See webpack-contrib/babel-minify-webpack-plugin#68
RubenVerborgh added a commit to SolidOS/mashlib that referenced this issue Oct 17, 2018
Copy link

@jbelien - use uglify. thats what I'm doing.

Copy link

anarcho-loneliness commented Mar 31, 2019

Hi there, I'm the person who added this error to source-map in mozilla/source-map#265. It looks like I didn't do a good enough job in explaining how to fix this error, I apologize for all the ruckus it has caused.

This error was added because, without it, source-map would silently output inaccurate mappings. I figured that a hard error was better than an inaccurate map.

Polymer/polymer-bundler#519 shows an example of how to fix this error in the code which calls source-map. For convenience, here's the relevant part of the diff:

It's basically just a bit of boilerplate which only adds the original object to the mapping if there is data to put in it. I'm not familiar enough with Babel or Webpack to say where exactly this fix needs to go, but hopefully somebody who knows more about webpack-sources can figure that part out.

I hope this helps, and sorry again for the trouble! If it's any consolation, this does at least indicate that potentially inaccurate source maps were being produced before, and this error is the first step to fixing them for everyone.

EDIT: I've filed mozilla/source-map#385 which I think is a potential root cause of this.

ebaynaud added a commit to ebaynaud/phone that referenced this issue Jun 7, 2019
ebaynaud added a commit to ebaynaud/phone that referenced this issue Jun 8, 2019
ebaynaud added a commit to ebaynaud/phone that referenced this issue Jun 8, 2019
ebaynaud added a commit to ebaynaud/phone that referenced this issue Jun 8, 2019
junhobaik added a commit to junhobaik/ that referenced this issue Jun 30, 2019
source-map 관련 버전, 의존성 오류로 보임.

gatsby에서 socurcemap을 비활성화하는 플러그인을 이용한 해결
avborup added a commit to avborup/rollespilsfabrikken-forum-calendar-frontend that referenced this issue Jul 2, 2019
A too large commit containing too many additions, most of which will be
refactored. This commit lays the foundation for the calendar system,
providing functionality to navigate months and highlighting dates.

The additions can be summarized as follows:

 - Add  component that keeps track of all calendar data and
   sub-components. Uses JavaScript's  type.

 - Add  module containing utility functions for
   interacting with JavaScript's  type.

 - Add  component that lays out a calendar month in a CSS

 - Add  file for localized theme settings.

 - Disable source maps in production due to Webpack errors. For similar
   issues, see webpack-contrib/babel-minify-webpack-plugin#68.

 - Other small things such as setting app-wide styles with ,
   adding (Danish) names for months and weekdays, and adding scss
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests