webpack 2.3.1 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +139 -132
- package/lib/APIPlugin.js +0 -6
- package/lib/AsyncDependenciesBlock.js +1 -1
- package/lib/AutomaticPrefetchPlugin.js +2 -2
- package/lib/CachePlugin.js +2 -2
- package/lib/CaseSensitiveModulesWarning.js +6 -3
- package/lib/ChunkRenderError.js +3 -1
- package/lib/ChunkTemplate.js +2 -2
- package/lib/Compilation.js +3 -3
- package/lib/Compiler.js +1 -1
- package/lib/ContextModule.js +3 -2
- package/lib/ContextModuleFactory.js +5 -5
- package/lib/DelegatedModule.js +67 -63
- package/lib/DependenciesBlock.js +65 -59
- package/lib/Dependency.js +1 -0
- package/lib/EntryModuleNotFoundError.js +16 -10
- package/lib/ExtendedAPIPlugin.js +7 -2
- package/lib/ExternalModuleFactoryPlugin.js +26 -23
- package/lib/FlagDependencyUsagePlugin.js +63 -75
- package/lib/HotModuleReplacement.runtime.js +25 -27
- package/lib/HotModuleReplacementPlugin.js +3 -5
- package/lib/IgnorePlugin.js +48 -17
- package/lib/JsonpChunkTemplatePlugin.js +24 -24
- package/lib/JsonpMainTemplatePlugin.js +182 -182
- package/lib/LibManifestPlugin.js +51 -46
- package/lib/MainTemplate.js +17 -18
- package/lib/Module.js +158 -160
- package/lib/ModuleBuildError.js +4 -2
- package/lib/ModuleDependencyError.js +2 -1
- package/lib/ModuleDependencyWarning.js +2 -1
- package/lib/ModuleError.js +2 -2
- package/lib/ModuleFilenameHelpers.js +27 -27
- package/lib/ModuleNotFoundError.js +3 -1
- package/lib/ModuleParseError.js +6 -4
- package/lib/ModuleWarning.js +2 -2
- package/lib/MultiCompiler.js +3 -4
- package/lib/MultiStats.js +3 -3
- package/lib/MultiWatching.js +2 -2
- package/lib/NamedChunksPlugin.js +30 -0
- package/lib/NodeStuffPlugin.js +80 -79
- package/lib/NormalModule.js +6 -2
- package/lib/NormalModuleFactory.js +244 -240
- package/lib/Parser.js +1256 -1079
- package/lib/ProgressPlugin.js +1 -1
- package/lib/RecordIdsPlugin.js +5 -9
- package/lib/SetVarMainTemplatePlugin.js +1 -1
- package/lib/SourceMapDevToolPlugin.js +153 -157
- package/lib/Stats.js +32 -5
- package/lib/TemplatedPathPlugin.js +1 -0
- package/lib/UnsupportedFeatureWarning.js +2 -1
- package/lib/WebpackError.js +11 -0
- package/lib/WebpackOptionsApply.js +1 -1
- package/lib/WebpackOptionsValidationError.js +8 -4
- package/lib/dependencies/AMDDefineDependency.js +10 -6
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +8 -1
- package/lib/dependencies/AMDPlugin.js +3 -3
- package/lib/dependencies/ContextDependencyHelpers.js +19 -16
- package/lib/dependencies/CriticalDependencyWarning.js +4 -1
- package/lib/dependencies/DepBlockHelpers.js +3 -3
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +2 -2
- package/lib/dependencies/ImportContextDependency.js +2 -1
- package/lib/dependencies/ImportDependenciesBlock.js +2 -2
- package/lib/dependencies/ImportParserPlugin.js +16 -2
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +11 -3
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +42 -13
- package/lib/dependencies/RequireEnsureDependency.js +9 -2
- package/lib/optimize/AggressiveSplittingPlugin.js +10 -17
- package/lib/optimize/CommonsChunkPlugin.js +1 -1
- package/lib/performance/AssetsOverSizeLimitWarning.js +4 -1
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +5 -1
- package/lib/performance/NoAsyncChunksWarning.js +5 -1
- package/lib/removeAndDo.js +6 -4
- package/lib/util/identifier.js +16 -0
- package/lib/webpack.js +2 -1
- package/package.json +4 -3
- package/schemas/ajv.absolutePath.js +1 -1
- package/schemas/webpackOptionsSchema.json +27 -0
@@ -2,7 +2,9 @@
|
|
2
2
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
3
|
Author Tobias Koppers @sokra
|
4
4
|
*/
|
5
|
-
|
5
|
+
"use strict";
|
6
|
+
|
7
|
+
const ModuleFilenameHelpers = exports;
|
6
8
|
|
7
9
|
ModuleFilenameHelpers.ALL_LOADERS_RESOURCE = "[all-loaders][resource]";
|
8
10
|
ModuleFilenameHelpers.REGEXP_ALL_LOADERS_RESOURCE = /\[all-?loaders\]\[resource\]/gi;
|
@@ -26,17 +28,17 @@ ModuleFilenameHelpers.HASH = "[hash]";
|
|
26
28
|
ModuleFilenameHelpers.REGEXP_HASH = /\[hash\]/gi;
|
27
29
|
|
28
30
|
function getAfter(str, token) {
|
29
|
-
|
31
|
+
const idx = str.indexOf(token);
|
30
32
|
return idx < 0 ? "" : str.substr(idx);
|
31
33
|
}
|
32
34
|
|
33
35
|
function getBefore(str, token) {
|
34
|
-
|
36
|
+
const idx = str.lastIndexOf(token);
|
35
37
|
return idx < 0 ? "" : str.substr(0, idx);
|
36
38
|
}
|
37
39
|
|
38
40
|
function getHash(str) {
|
39
|
-
|
41
|
+
const hash = require("crypto").createHash("md5");
|
40
42
|
hash.update(str);
|
41
43
|
return hash.digest("hex").substr(0, 4);
|
42
44
|
}
|
@@ -47,12 +49,12 @@ function asRegExp(test) {
|
|
47
49
|
}
|
48
50
|
|
49
51
|
ModuleFilenameHelpers.createFilename = function createFilename(module, moduleFilenameTemplate, requestShortener) {
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
if(
|
52
|
+
let absoluteResourcePath;
|
53
|
+
let hash;
|
54
|
+
let identifier;
|
55
|
+
let moduleId;
|
56
|
+
let shortIdentifier;
|
57
|
+
if(module === undefined) module = "";
|
56
58
|
if(typeof module === "string") {
|
57
59
|
shortIdentifier = requestShortener.shorten(module);
|
58
60
|
identifier = shortIdentifier;
|
@@ -63,14 +65,14 @@ ModuleFilenameHelpers.createFilename = function createFilename(module, moduleFil
|
|
63
65
|
shortIdentifier = module.readableIdentifier(requestShortener);
|
64
66
|
identifier = requestShortener.shorten(module.identifier());
|
65
67
|
moduleId = module.id;
|
66
|
-
absoluteResourcePath = module.
|
68
|
+
absoluteResourcePath = module.identifier().split("!").pop();
|
67
69
|
hash = getHash(identifier);
|
68
70
|
}
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
const resource = shortIdentifier.split("!").pop();
|
72
|
+
const loaders = getBefore(shortIdentifier, "!");
|
73
|
+
const allLoaders = getBefore(identifier, "!");
|
74
|
+
const query = getAfter(resource, "?");
|
75
|
+
const resourcePath = resource.substr(0, resource.length - query.length);
|
74
76
|
if(typeof moduleFilenameTemplate === "function") {
|
75
77
|
return moduleFilenameTemplate({
|
76
78
|
identifier: identifier,
|
@@ -102,35 +104,33 @@ ModuleFilenameHelpers.createFooter = function createFooter(module, requestShorte
|
|
102
104
|
if(typeof module === "string") {
|
103
105
|
return [
|
104
106
|
"// WEBPACK FOOTER //",
|
105
|
-
|
107
|
+
`// ${requestShortener.shorten(module)}`
|
106
108
|
].join("\n");
|
107
109
|
} else {
|
108
110
|
return [
|
109
111
|
"//////////////////",
|
110
112
|
"// WEBPACK FOOTER",
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
return c.id;
|
115
|
-
}).join(" ")
|
113
|
+
`// ${module.readableIdentifier(requestShortener)}`,
|
114
|
+
`// module id = ${module.id}`,
|
115
|
+
`// module chunks = ${module.chunks.map(c => c.id).join(" ")}`
|
116
116
|
].join("\n");
|
117
117
|
}
|
118
118
|
};
|
119
119
|
|
120
120
|
ModuleFilenameHelpers.replaceDuplicates = function replaceDuplicates(array, fn, comparator) {
|
121
|
-
|
122
|
-
|
123
|
-
array.forEach(
|
121
|
+
const countMap = Object.create(null);
|
122
|
+
const posMap = Object.create(null);
|
123
|
+
array.forEach((item, idx) => {
|
124
124
|
countMap[item] = (countMap[item] || []);
|
125
125
|
countMap[item].push(idx);
|
126
126
|
posMap[item] = 0;
|
127
127
|
});
|
128
128
|
if(comparator) {
|
129
|
-
Object.keys(countMap).forEach(
|
129
|
+
Object.keys(countMap).forEach(item => {
|
130
130
|
countMap[item].sort(comparator);
|
131
131
|
});
|
132
132
|
}
|
133
|
-
return array.map(
|
133
|
+
return array.map((item, i) => {
|
134
134
|
if(countMap[item].length > 1) {
|
135
135
|
if(comparator && countMap[item][0] === i)
|
136
136
|
return item;
|
package/lib/ModuleParseError.js
CHANGED
@@ -4,9 +4,12 @@
|
|
4
4
|
*/
|
5
5
|
"use strict";
|
6
6
|
|
7
|
-
|
7
|
+
const WebpackError = require("./WebpackError");
|
8
|
+
|
9
|
+
class ModuleParseError extends WebpackError {
|
8
10
|
constructor(module, source, err) {
|
9
11
|
super();
|
12
|
+
|
10
13
|
this.name = "ModuleParseError";
|
11
14
|
this.message = "Module parse failed: " + module.request + " " + err.message;
|
12
15
|
this.message += "\nYou may need an appropriate loader to handle this file type.";
|
@@ -23,9 +26,8 @@ class ModuleParseError extends Error {
|
|
23
26
|
}
|
24
27
|
this.module = module;
|
25
28
|
this.error = err;
|
26
|
-
|
27
|
-
|
28
|
-
}
|
29
|
+
|
30
|
+
Error.captureStackTrace(this, this.constructor);
|
29
31
|
}
|
30
32
|
}
|
31
33
|
|
package/lib/ModuleWarning.js
CHANGED
@@ -4,10 +4,10 @@
|
|
4
4
|
*/
|
5
5
|
"use strict";
|
6
6
|
|
7
|
+
const WebpackError = require("./WebpackError");
|
7
8
|
const cleanUp = require("./ErrorHelpers").cleanUp;
|
8
9
|
|
9
|
-
class ModuleWarning extends
|
10
|
-
|
10
|
+
class ModuleWarning extends WebpackError {
|
11
11
|
constructor(module, warning) {
|
12
12
|
super();
|
13
13
|
|
package/lib/MultiCompiler.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Author Tobias Koppers @sokra
|
4
4
|
*/
|
5
5
|
var Tapable = require("tapable");
|
6
|
-
var
|
6
|
+
var asyncLib = require("async");
|
7
7
|
var MultiWatching = require("./MultiWatching");
|
8
8
|
var MultiStats = require("./MultiStats");
|
9
9
|
|
@@ -100,7 +100,7 @@ function runWithDependencies(compilers, fn, callback) {
|
|
100
100
|
|
101
101
|
function runCompilers(callback) {
|
102
102
|
if(remainingCompilers.length === 0) return callback();
|
103
|
-
|
103
|
+
asyncLib.map(getReadyCompilers(), function(compiler, callback) {
|
104
104
|
fn(compiler, function(err) {
|
105
105
|
if(err) return callback(err);
|
106
106
|
fulfilledNames[compiler.name] = true;
|
@@ -119,11 +119,10 @@ MultiCompiler.prototype.watch = function(watchOptions, handler) {
|
|
119
119
|
var compilerStatus = this.compilers.map(function() {
|
120
120
|
return false;
|
121
121
|
});
|
122
|
-
|
123
122
|
runWithDependencies(this.compilers, function(compiler, callback) {
|
124
123
|
var compilerIdx = this.compilers.indexOf(compiler);
|
125
124
|
var firstRun = true;
|
126
|
-
var watching = compiler.watch(watchOptions, function(err, stats) {
|
125
|
+
var watching = compiler.watch(Array.isArray(watchOptions) ? watchOptions[compilerIdx] : watchOptions, function(err, stats) {
|
127
126
|
if(err)
|
128
127
|
handler(err);
|
129
128
|
if(stats) {
|
package/lib/MultiStats.js
CHANGED
@@ -11,7 +11,7 @@ const optionOrFallback = (optionValue, fallbackValue) => optionValue !== undefin
|
|
11
11
|
class MultiStats {
|
12
12
|
constructor(stats) {
|
13
13
|
this.stats = stats;
|
14
|
-
this.hash = stats.map(
|
14
|
+
this.hash = stats.map(stat => stat.hash).join("");
|
15
15
|
}
|
16
16
|
|
17
17
|
hasErrors() {
|
@@ -42,12 +42,12 @@ class MultiStats {
|
|
42
42
|
});
|
43
43
|
const obj = {
|
44
44
|
errors: jsons.reduce((arr, j) => {
|
45
|
-
return arr.concat(j.errors.map(
|
45
|
+
return arr.concat(j.errors.map(msg => {
|
46
46
|
return `(${j.name}) ${msg}`;
|
47
47
|
}));
|
48
48
|
}, []),
|
49
49
|
warnings: jsons.reduce((arr, j) => {
|
50
|
-
return arr.concat(j.warnings.map(
|
50
|
+
return arr.concat(j.warnings.map(msg => {
|
51
51
|
return `(${j.name}) ${msg}`;
|
52
52
|
}));
|
53
53
|
}, [])
|
package/lib/MultiWatching.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
*/
|
5
5
|
"use strict";
|
6
6
|
|
7
|
-
const
|
7
|
+
const asyncLib = require("async");
|
8
8
|
|
9
9
|
class MultiWatching {
|
10
10
|
constructor(watchings, compiler) {
|
@@ -19,7 +19,7 @@ class MultiWatching {
|
|
19
19
|
close(callback) {
|
20
20
|
if(callback === undefined) callback = () => { /*do nothing*/ };
|
21
21
|
|
22
|
-
|
22
|
+
asyncLib.forEach(this.watchings, (watching, finishedCallback) => {
|
23
23
|
watching.close(finishedCallback);
|
24
24
|
}, err => {
|
25
25
|
this.compiler.applyPlugins("watch-close");
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
"use strict";
|
6
|
+
|
7
|
+
class NamedChunksPlugin {
|
8
|
+
|
9
|
+
static defaultNameResolver(chunk) {
|
10
|
+
return chunk.name || null;
|
11
|
+
}
|
12
|
+
|
13
|
+
constructor(nameResolver) {
|
14
|
+
this.nameResolver = nameResolver || NamedChunksPlugin.defaultNameResolver;
|
15
|
+
}
|
16
|
+
|
17
|
+
apply(compiler) {
|
18
|
+
compiler.plugin("compilation", (compilation) => {
|
19
|
+
compilation.plugin("before-chunk-ids", (chunks) => {
|
20
|
+
chunks.forEach((chunk) => {
|
21
|
+
if(chunk.id === null) {
|
22
|
+
chunk.id = this.nameResolver(chunk);
|
23
|
+
}
|
24
|
+
});
|
25
|
+
});
|
26
|
+
});
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
module.exports = NamedChunksPlugin;
|
package/lib/NodeStuffPlugin.js
CHANGED
@@ -2,95 +2,96 @@
|
|
2
2
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
3
|
Author Tobias Koppers @sokra
|
4
4
|
*/
|
5
|
-
|
6
|
-
var ParserHelpers = require("./ParserHelpers");
|
7
|
-
var ConstDependency = require("./dependencies/ConstDependency");
|
5
|
+
"use strict";
|
8
6
|
|
9
|
-
|
7
|
+
const path = require("path");
|
8
|
+
const ParserHelpers = require("./ParserHelpers");
|
9
|
+
const ConstDependency = require("./dependencies/ConstDependency");
|
10
10
|
|
11
|
-
|
12
|
-
this.options = options;
|
13
|
-
}
|
14
|
-
module.exports = NodeStuffPlugin;
|
15
|
-
NodeStuffPlugin.prototype.apply = function(compiler) {
|
16
|
-
var options = this.options;
|
17
|
-
compiler.plugin("compilation", function(compilation, params) {
|
18
|
-
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
|
19
|
-
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
|
11
|
+
const NullFactory = require("./NullFactory");
|
20
12
|
|
21
|
-
|
13
|
+
class NodeStuffPlugin {
|
14
|
+
constructor(options) {
|
15
|
+
this.options = options;
|
16
|
+
}
|
22
17
|
|
23
|
-
|
24
|
-
|
18
|
+
apply(compiler) {
|
19
|
+
const options = this.options;
|
20
|
+
compiler.plugin("compilation", (compilation, params) => {
|
21
|
+
compilation.dependencyFactories.set(ConstDependency, new NullFactory());
|
22
|
+
compilation.dependencyTemplates.set(ConstDependency, new ConstDependency.Template());
|
25
23
|
|
26
|
-
|
27
|
-
if(parserOptions.node)
|
28
|
-
localOptions = Object.assign({}, localOptions, parserOptions.node);
|
24
|
+
params.normalModuleFactory.plugin("parser", (parser, parserOptions) => {
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
if(parserOptions.node === false)
|
27
|
+
return;
|
28
|
+
|
29
|
+
let localOptions = options;
|
30
|
+
if(parserOptions.node)
|
31
|
+
localOptions = Object.assign({}, localOptions, parserOptions.node);
|
36
32
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
33
|
+
function setConstant(expressionName, value) {
|
34
|
+
parser.plugin(`expression ${expressionName}`, function() {
|
35
|
+
this.state.current.addVariable(expressionName, JSON.stringify(value));
|
36
|
+
return true;
|
37
|
+
});
|
38
|
+
}
|
39
|
+
|
40
|
+
function setModuleConstant(expressionName, fn) {
|
41
|
+
parser.plugin(`expression ${expressionName}`, function() {
|
42
|
+
this.state.current.addVariable(expressionName, JSON.stringify(fn(this.state.module)));
|
43
|
+
return true;
|
44
|
+
});
|
45
|
+
}
|
46
|
+
const context = compiler.context;
|
47
|
+
if(localOptions.__filename === "mock") {
|
48
|
+
setConstant("__filename", "/index.js");
|
49
|
+
} else if(localOptions.__filename) {
|
50
|
+
setModuleConstant("__filename", module => path.relative(context, module.resource));
|
51
|
+
}
|
52
|
+
parser.plugin("evaluate Identifier __filename", function(expr) {
|
53
|
+
if(!this.state.module) return;
|
54
|
+
const resource = this.state.module.resource;
|
55
|
+
const i = resource.indexOf("?");
|
56
|
+
return ParserHelpers.evaluateToString(i < 0 ? resource : resource.substr(0, i))(expr);
|
41
57
|
});
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
58
|
+
if(localOptions.__dirname === "mock") {
|
59
|
+
setConstant("__dirname", "/");
|
60
|
+
} else if(localOptions.__dirname) {
|
61
|
+
setModuleConstant("__dirname", module => path.relative(context, module.context));
|
62
|
+
}
|
63
|
+
parser.plugin("evaluate Identifier __dirname", function(expr) {
|
64
|
+
if(!this.state.module) return;
|
65
|
+
return ParserHelpers.evaluateToString(this.state.module.context)(expr);
|
49
66
|
});
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
67
|
+
parser.plugin("expression require.main", ParserHelpers.toConstantDependency("__webpack_require__.c[__webpack_require__.s]"));
|
68
|
+
parser.plugin(
|
69
|
+
"expression require.extensions",
|
70
|
+
ParserHelpers.expressionIsUnsupported("require.extensions is not supported by webpack. Use a loader instead.")
|
71
|
+
);
|
72
|
+
parser.plugin("expression module.loaded", ParserHelpers.toConstantDependency("module.l"));
|
73
|
+
parser.plugin("expression module.id", ParserHelpers.toConstantDependency("module.i"));
|
74
|
+
parser.plugin("expression module.exports", function() {
|
75
|
+
const module = this.state.module;
|
76
|
+
const isHarmony = module.meta && module.meta.harmonyModule;
|
77
|
+
if(!isHarmony)
|
78
|
+
return true;
|
62
79
|
});
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
parser.plugin("expression module.loaded", ParserHelpers.toConstantDependency("module.l"));
|
74
|
-
parser.plugin("expression module.id", ParserHelpers.toConstantDependency("module.i"));
|
75
|
-
parser.plugin("expression module.exports", function() {
|
76
|
-
var module = this.state.module;
|
77
|
-
var isHarmony = module.meta && module.meta.harmonyModule;
|
78
|
-
if(!isHarmony)
|
79
|
-
return true;
|
80
|
-
});
|
81
|
-
parser.plugin("evaluate Identifier module.hot", ParserHelpers.evaluateToBoolean(false));
|
82
|
-
parser.plugin("expression module", function() {
|
83
|
-
var module = this.state.module;
|
84
|
-
var isHarmony = module.meta && module.meta.harmonyModule;
|
85
|
-
var moduleJsPath = path.join(__dirname, "..", "buildin", isHarmony ? "harmony-module.js" : "module.js");
|
86
|
-
if(module.context) {
|
87
|
-
moduleJsPath = path.relative(this.state.module.context, moduleJsPath);
|
88
|
-
if(!/^[A-Z]:/i.test(moduleJsPath)) {
|
89
|
-
moduleJsPath = "./" + moduleJsPath.replace(/\\/g, "/");
|
80
|
+
parser.plugin("evaluate Identifier module.hot", ParserHelpers.evaluateToBoolean(false));
|
81
|
+
parser.plugin("expression module", function() {
|
82
|
+
const module = this.state.module;
|
83
|
+
const isHarmony = module.meta && module.meta.harmonyModule;
|
84
|
+
let moduleJsPath = path.join(__dirname, "..", "buildin", isHarmony ? "harmony-module.js" : "module.js");
|
85
|
+
if(module.context) {
|
86
|
+
moduleJsPath = path.relative(this.state.module.context, moduleJsPath);
|
87
|
+
if(!/^[A-Z]:/i.test(moduleJsPath)) {
|
88
|
+
moduleJsPath = `./${moduleJsPath.replace(/\\/g, "/")}`;
|
89
|
+
}
|
90
90
|
}
|
91
|
-
|
92
|
-
|
91
|
+
return ParserHelpers.addParsedVariableToModule(this, "module", `require(${JSON.stringify(moduleJsPath)})(module)`);
|
92
|
+
});
|
93
93
|
});
|
94
94
|
});
|
95
|
-
}
|
96
|
-
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
module.exports = NodeStuffPlugin;
|
package/lib/NormalModule.js
CHANGED
@@ -15,6 +15,7 @@ const ReplaceSource = require("webpack-sources").ReplaceSource;
|
|
15
15
|
const CachedSource = require("webpack-sources").CachedSource;
|
16
16
|
const LineToLineMappedSource = require("webpack-sources").LineToLineMappedSource;
|
17
17
|
|
18
|
+
const WebpackError = require("./WebpackError");
|
18
19
|
const Module = require("./Module");
|
19
20
|
const ModuleParseError = require("./ModuleParseError");
|
20
21
|
const ModuleBuildError = require("./ModuleBuildError");
|
@@ -42,8 +43,7 @@ function contextify(context, request) {
|
|
42
43
|
}).join("!");
|
43
44
|
}
|
44
45
|
|
45
|
-
class NonErrorEmittedError extends
|
46
|
-
|
46
|
+
class NonErrorEmittedError extends WebpackError {
|
47
47
|
constructor(error) {
|
48
48
|
super();
|
49
49
|
|
@@ -456,6 +456,10 @@ class NormalModule extends Module {
|
|
456
456
|
return new CachedSource(source);
|
457
457
|
}
|
458
458
|
|
459
|
+
originalSource() {
|
460
|
+
return this._source;
|
461
|
+
}
|
462
|
+
|
459
463
|
getHighestTimestamp(keys, timestampsByKey) {
|
460
464
|
let highestTimestamp = 0;
|
461
465
|
for(let i = 0; i < keys.length; i++) {
|