diff --git a/package.json b/package.json index 5584afd..42e9087 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "async": "~0.9.0", "loader-utils": "^0.2.5", "lodash": "^3.8.0", - "source-map": "^0.1.41", + "source-map": "^0.5.6", "webpack-dev-middleware": "^1.0.11" }, "devDependencies": { diff --git a/src/mocha-env-loader.js b/src/mocha-env-loader.js index d2524e0..5d5d623 100644 --- a/src/mocha-env-loader.js +++ b/src/mocha-env-loader.js @@ -1,7 +1,9 @@ -//var path = require('path') -var SourceNode = require('source-map').SourceNode +var sourceMap = require('source-map') var loaderUtils = require('loader-utils') +var SourceNode = sourceMap.SourceNode +var SourceMapConsumer = sourceMap.SourceMapConsumer + module.exports = function(content, map) { this.cacheable() @@ -9,11 +11,11 @@ module.exports = function(content, map) { var id = this.options.name if (!id) { - this.callback(null, content, map) + return this.callback(null, content, map) } if (map) { - sourceNode = SourceNode.fromSourceWithMap(content, map) + sourceNode = SourceNode.fromStringWithSourceMap(content, new SourceMapConsumer(map)) } else { var fileName = loaderUtils.getRemainingRequest(this)