Skip to content

Commit f39e19a

Browse files
authored
Merge pull request webpack#5066 from webpack/deprecation/webpack-3
remove deprecated stuff
2 parents 1c2835a + 57e4a2d commit f39e19a

File tree

31 files changed

+59
-103
lines changed

31 files changed

+59
-103
lines changed

examples/code-splitted-css-bundle/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var ExtractTextPlugin = require("extract-text-webpack-plugin");
22
module.exports = {
33
module: {
4-
loaders: [
4+
rules: [
55
{
66
test: /\.css$/,
77
use: ExtractTextPlugin.extract({

examples/coffee-script/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
module: {
3-
loaders: [
3+
rules: [
44
{ test: /\.coffee$/, loader: "coffee-loader" }
55
]
66
},

examples/css-bundle/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var ExtractTextPlugin = require("extract-text-webpack-plugin");
22
module.exports = {
33
module: {
4-
loaders: [
4+
rules: [
55
{
66
test: /\.css$/,
77
use: ExtractTextPlugin.extract({

examples/loader/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
module: {
3-
loaders: [
3+
rules: [
44
{ test: /\.css$/, loader: "css-loader" }
55
]
66
}

examples/multiple-entry-points-commons-chunk-css-bundle/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
filename: "[name].js"
1313
},
1414
module: {
15-
loaders: [
15+
rules: [
1616
{
1717
test: /\.css$/,
1818
use: ExtractTextPlugin.extract({

lib/CachePlugin.js

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,19 @@ class CachePlugin {
2020
} else {
2121
const registerCacheToCompiler = (compiler, cache) => {
2222
compiler.plugin("this-compilation", compilation => {
23-
// TODO remove notCacheable for webpack 4
24-
if(!compilation.notCacheable) {
25-
compilation.cache = cache;
26-
compilation.plugin("child-compiler", (childCompiler, compilerName, compilerIndex) => {
27-
if(cache) {
28-
let childCache;
29-
if(!cache.children) cache.children = {};
30-
if(!cache.children[compilerName]) cache.children[compilerName] = [];
31-
if(cache.children[compilerName][compilerIndex])
32-
childCache = cache.children[compilerName][compilerIndex];
33-
else
34-
cache.children[compilerName].push(childCache = {});
35-
registerCacheToCompiler(childCompiler, childCache);
36-
}
37-
});
38-
} else if(this.watching) {
39-
compilation.warnings.push(
40-
new Error(`CachePlugin - Cache cannot be used because of: ${compilation.notCacheable}`)
41-
);
42-
}
23+
compilation.cache = cache;
24+
compilation.plugin("child-compiler", (childCompiler, compilerName, compilerIndex) => {
25+
if(cache) {
26+
let childCache;
27+
if(!cache.children) cache.children = {};
28+
if(!cache.children[compilerName]) cache.children[compilerName] = [];
29+
if(cache.children[compilerName][compilerIndex])
30+
childCache = cache.children[compilerName][compilerIndex];
31+
else
32+
cache.children[compilerName].push(childCache = {});
33+
registerCacheToCompiler(childCompiler, childCache);
34+
}
35+
});
4336
});
4437
};
4538
registerCacheToCompiler(compiler, this.cache);

lib/Dependency.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ class Dependency {
4545
disconnect() {
4646
this.module = null;
4747
}
48-
49-
// TODO: remove in webpack 3
50-
compare(a, b) {
51-
return compareLocations(a.loc, b.loc);
52-
}
5348
}
5449
Dependency.compare = (a, b) => compareLocations(a.loc, b.loc);
5550

lib/HotModuleReplacement.runtime.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,6 @@ module.exports = function() {
561561
type: "self-accept-error-handler-errored",
562562
moduleId: moduleId,
563563
error: err2,
564-
orginalError: err, // TODO remove in webpack 4
565564
originalError: err
566565
});
567566
}

lib/NormalModule.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,10 @@ class NormalModule extends Module {
132132
resolve(context, request, callback) {
133133
resolver.resolve({}, context, request, callback);
134134
},
135-
resolveSync(context, request) {
136-
return resolver.resolveSync({}, context, request);
137-
},
138135
emitFile: (name, content, sourceMap) => {
139136
this.assets[name] = this.createSourceForAsset(name, content, sourceMap);
140137
},
141-
options: options,
138+
rootContext: options.context,
142139
webpack: true,
143140
sourceMap: !!this.useSourceMap,
144141
_module: this,

lib/NormalModuleFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class NormalModuleFactory extends Tapable {
4646
constructor(context, resolvers, options) {
4747
super();
4848
this.resolvers = resolvers;
49-
this.ruleSet = new RuleSet(options.rules || options.loaders);
49+
this.ruleSet = new RuleSet(options.rules);
5050
this.cachePredicate = typeof options.unsafeCache === "function" ? options.unsafeCache : Boolean.bind(null, options.unsafeCache);
5151
this.context = context || "";
5252
this.parserCache = {};

0 commit comments

Comments
 (0)