mirror of https://github.com/webpack/webpack.git
Merge pull request #14117 from webpack/feature/import-module
add importModule to loader context by default
This commit is contained in:
commit
41e3136c83
|
@ -1106,10 +1106,6 @@ export interface Experiments {
|
|||
* Build http(s): urls using a lockfile and resource content cache.
|
||||
*/
|
||||
buildHttp?: boolean | HttpUriOptions;
|
||||
/**
|
||||
* Enable build-time execution of modules from the module graph for plugins and loaders.
|
||||
*/
|
||||
executeModule?: boolean;
|
||||
/**
|
||||
* Enable module and chunk layers.
|
||||
*/
|
||||
|
|
|
@ -305,9 +305,7 @@ class WebpackOptionsApply extends OptionsApply {
|
|||
new RequireJsStuffPlugin().apply(compiler);
|
||||
}
|
||||
new CommonJsPlugin().apply(compiler);
|
||||
new LoaderPlugin({
|
||||
enableExecuteModule: options.experiments.executeModule
|
||||
}).apply(compiler);
|
||||
new LoaderPlugin({}).apply(compiler);
|
||||
if (options.node !== false) {
|
||||
const NodeStuffPlugin = require("./NodeStuffPlugin");
|
||||
new NodeStuffPlugin(options.node).apply(compiler);
|
||||
|
|
|
@ -259,7 +259,6 @@ const applyExperimentsDefaults = (experiments, { production, development }) => {
|
|||
D(experiments, "asyncWebAssembly", false);
|
||||
D(experiments, "outputModule", false);
|
||||
D(experiments, "asset", false);
|
||||
D(experiments, "executeModule", false);
|
||||
D(experiments, "layers", false);
|
||||
D(experiments, "lazyCompilation", false);
|
||||
D(experiments, "buildHttp", false);
|
||||
|
|
|
@ -37,11 +37,9 @@ const LoaderImportDependency = require("./LoaderImportDependency");
|
|||
class LoaderPlugin {
|
||||
/**
|
||||
* @param {Object} options options
|
||||
* @param {boolean=} options.enableExecuteModule execute module enabled
|
||||
*/
|
||||
constructor(options = {}) {
|
||||
this._enableExecuteModule = !!options.enableExecuteModule;
|
||||
}
|
||||
constructor(options = {}) {}
|
||||
|
||||
/**
|
||||
* Apply the plugin
|
||||
* @param {Compiler} compiler the compiler instance
|
||||
|
@ -155,7 +153,6 @@ class LoaderPlugin {
|
|||
);
|
||||
};
|
||||
|
||||
if (this._enableExecuteModule) {
|
||||
/**
|
||||
* @param {string} request the request string to load the module from
|
||||
* @param {ImportModuleOptions=} options options
|
||||
|
@ -255,7 +252,6 @@ class LoaderPlugin {
|
|||
return importModule(request, options || {}, callback);
|
||||
};
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -699,10 +699,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"executeModule": {
|
||||
"description": "Enable build-time execution of modules from the module graph for plugins and loaders.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"layers": {
|
||||
"description": "Enable module and chunk layers.",
|
||||
"type": "boolean"
|
||||
|
|
|
@ -94,7 +94,6 @@ describe("Defaults", () => {
|
|||
"asset": false,
|
||||
"asyncWebAssembly": false,
|
||||
"buildHttp": false,
|
||||
"executeModule": false,
|
||||
"layers": false,
|
||||
"lazyCompilation": false,
|
||||
"outputModule": false,
|
||||
|
|
|
@ -524,19 +524,6 @@ Object {
|
|||
"multiple": false,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
"experiments-execute-module": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
"description": "Enable build-time execution of modules from the module graph for plugins and loaders.",
|
||||
"multiple": false,
|
||||
"path": "experiments.executeModule",
|
||||
"type": "boolean",
|
||||
},
|
||||
],
|
||||
"description": "Enable build-time execution of modules from the module graph for plugins and loaders.",
|
||||
"multiple": false,
|
||||
"simpleType": "boolean",
|
||||
},
|
||||
"experiments-layers": Object {
|
||||
"configs": Array [
|
||||
Object {
|
||||
|
|
|
@ -41,9 +41,6 @@ module.exports = {
|
|||
}
|
||||
]
|
||||
},
|
||||
experiments: {
|
||||
executeModule: true
|
||||
},
|
||||
plugins: [
|
||||
compiler =>
|
||||
compiler.hooks.done.tap("test case", stats => {
|
||||
|
|
|
@ -14,9 +14,6 @@ module.exports = {
|
|||
}
|
||||
]
|
||||
},
|
||||
experiments: {
|
||||
executeModule: true
|
||||
},
|
||||
plugins: [
|
||||
compiler =>
|
||||
compiler.hooks.done.tap("test case", stats => {
|
||||
|
|
|
@ -8,8 +8,5 @@ module.exports = {
|
|||
type: "json"
|
||||
}
|
||||
]
|
||||
},
|
||||
experiments: {
|
||||
executeModule: true
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3282,11 +3282,6 @@ declare interface Experiments {
|
|||
*/
|
||||
buildHttp?: boolean | HttpUriOptions;
|
||||
|
||||
/**
|
||||
* Enable build-time execution of modules from the module graph for plugins and loaders.
|
||||
*/
|
||||
executeModule?: boolean;
|
||||
|
||||
/**
|
||||
* Enable module and chunk layers.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue