imports-loader
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -80,11 +80,29 @@ "use strict"; | ||
if (this.sourceMap && sourceMap) { | ||
const node = _sourceMap.SourceNode.fromStringWithSourceMap(content, new _sourceMap.SourceMapConsumer(sourceMap)); | ||
if (this.sourceMap) { | ||
if (sourceMap) { | ||
const node = _sourceMap.SourceNode.fromStringWithSourceMap(content, new _sourceMap.SourceMapConsumer(sourceMap)); | ||
node.prepend(`${importsCode}\n`); | ||
node.add(codeAfterModule); | ||
const result = node.toStringWithSourceMap({ | ||
file: this.resourcePath | ||
node.prepend(`${importsCode}\n`); | ||
node.add(codeAfterModule); | ||
const result = node.toStringWithSourceMap({ | ||
file: this.resourcePath | ||
}); | ||
callback(null, result.code, result.map.toJSON()); | ||
return; | ||
} | ||
const generator = new _sourceMap.SourceMapGenerator(); | ||
generator.setSourceContent(this.resourcePath, content); | ||
generator.addMapping({ | ||
generated: { | ||
line: importsCode.split("\n").length + 1, | ||
column: 0 | ||
}, | ||
original: { | ||
line: 1, | ||
column: 0 | ||
}, | ||
source: this.resourcePath | ||
}); | ||
callback(null, result.code, result.map.toJSON()); | ||
callback(null, `${importsCode}\n${content}\n${codeAfterModule}`, generator.toString()); | ||
return; | ||
@@ -91,0 +109,0 @@ } |
{ | ||
"name": "imports-loader", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "imports loader module for webpack", | ||
@@ -50,4 +50,4 @@ "license": "MIT", | ||
"@babel/preset-env": "^7.14.2", | ||
"@commitlint/cli": "^13.2.1", | ||
"@commitlint/config-conventional": "^13.2.0", | ||
"@commitlint/cli": "^14.1.0", | ||
"@commitlint/config-conventional": "^14.1.0", | ||
"@webpack-contrib/eslint-config-webpack": "^3.0.0", | ||
@@ -54,0 +54,0 @@ "babel-jest": "^27.3.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36906
492