Merge pull request #11528 from webpack/improvements/little-missing-things
little improvements
This commit is contained in:
commit
ffc360e312
|
@ -461,6 +461,10 @@ class HotModuleReplacementPlugin {
|
|||
ChunkGraph.setChunkGraphForChunk(hotUpdateChunk, chunkGraph);
|
||||
hotUpdateChunk.id = chunkId;
|
||||
hotUpdateChunk.runtime = newRuntime;
|
||||
if (currentChunk) {
|
||||
for (const group of currentChunk.groupsIterable)
|
||||
hotUpdateChunk.addGroup(group);
|
||||
}
|
||||
chunkGraph.attachModules(hotUpdateChunk, newModules || []);
|
||||
chunkGraph.attachRuntimeModules(
|
||||
hotUpdateChunk,
|
||||
|
|
|
@ -241,7 +241,7 @@ class CommonJsExportsParserPlugin {
|
|||
bailoutHint(
|
||||
`${base}${propertyAccess(
|
||||
members
|
||||
)}(...) prevents optimization as ${base} is passed as call context as ${formatLocation(
|
||||
)}(...) prevents optimization as ${base} is passed as call context at ${formatLocation(
|
||||
expr.loc
|
||||
)}`
|
||||
);
|
||||
|
|
|
@ -266,6 +266,7 @@ HarmonyImportSpecifierDependency.Template = class HarmonyImportSpecifierDependen
|
|||
|
||||
let exportExpr;
|
||||
if (
|
||||
connection &&
|
||||
concatenationScope &&
|
||||
concatenationScope.isModuleInScope(connection.module)
|
||||
) {
|
||||
|
|
|
@ -154,6 +154,9 @@ module.exports = mergeExports(fn, {
|
|||
get Generator() {
|
||||
return require("./Generator");
|
||||
},
|
||||
get HotUpdateChunk() {
|
||||
return require("./HotUpdateChunk");
|
||||
},
|
||||
get HotModuleReplacementPlugin() {
|
||||
return require("./HotModuleReplacementPlugin");
|
||||
},
|
||||
|
@ -351,6 +354,9 @@ module.exports = mergeExports(fn, {
|
|||
},
|
||||
|
||||
runtime: {
|
||||
get GetChunkFilenameRuntimeModule() {
|
||||
return require("./runtime/GetChunkFilenameRuntimeModule");
|
||||
},
|
||||
get LoadScriptRuntimeModule() {
|
||||
return require("./runtime/LoadScriptRuntimeModule");
|
||||
}
|
||||
|
|
|
@ -134,20 +134,24 @@ exports.arrayToSetDeprecation = (set, name) => {
|
|||
};
|
||||
return fn;
|
||||
};
|
||||
let indexerDefined = 0;
|
||||
const defineIndexGetter = index => {
|
||||
Object.defineProperty(set, index, {
|
||||
get: createIndexGetter(index),
|
||||
set(value) {
|
||||
throw new Error(
|
||||
`${name} was changed from Array to Set (indexing Array with write is not possible)`
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
defineIndexGetter(0);
|
||||
let indexerDefined = 1;
|
||||
Object.defineProperty(set, "length", {
|
||||
get() {
|
||||
dLength();
|
||||
const length = this.size;
|
||||
for (indexerDefined; indexerDefined < length; indexerDefined++) {
|
||||
Object.defineProperty(set, indexerDefined, {
|
||||
get: createIndexGetter(indexerDefined),
|
||||
set(value) {
|
||||
throw new Error(
|
||||
`${name} was changed from Array to Set (indexing Array with write is not possible)`
|
||||
);
|
||||
}
|
||||
});
|
||||
for (indexerDefined; indexerDefined < length + 1; indexerDefined++) {
|
||||
defineIndexGetter(indexerDefined);
|
||||
}
|
||||
return length;
|
||||
},
|
||||
|
|
|
@ -11,34 +11,61 @@ const validate = require("schema-utils");
|
|||
const DID_YOU_MEAN = {
|
||||
rules: "module.rules",
|
||||
loaders: "module.rules or module.rules.*.use",
|
||||
query: "module.rules.*.options (BREAKING CHANGE since webpack 5)",
|
||||
noParse: "module.noParse",
|
||||
filename: "output.filename or module.rules.*.generator.filename",
|
||||
file: "output.filename",
|
||||
jsonpFunction: "output.chunkLoadingGlobal",
|
||||
chunkCallbackName: "output.chunkLoadingGlobal",
|
||||
hotUpdateFunction: "output.hotUpdateGlobal",
|
||||
chunkFilename: "output.chunkFilename",
|
||||
chunkfilename: "output.chunkFilename",
|
||||
ecmaVersion: "output.environment",
|
||||
ecmaversion: "output.environment",
|
||||
ecma: "output.environment",
|
||||
ecmaVersion:
|
||||
"output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)",
|
||||
ecmaversion:
|
||||
"output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)",
|
||||
ecma:
|
||||
"output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)",
|
||||
path: "output.path",
|
||||
pathinfo: "output.pathinfo",
|
||||
pathInfo: "output.pathinfo",
|
||||
jsonpFunction: "output.chunkLoadingGlobal (BREAKING CHANGE since webpack 5)",
|
||||
chunkCallbackName:
|
||||
"output.chunkLoadingGlobal (BREAKING CHANGE since webpack 5)",
|
||||
jsonpScriptType: "output.scriptType (BREAKING CHANGE since webpack 5)",
|
||||
hotUpdateFunction: "output.hotUpdateGlobal (BREAKING CHANGE since webpack 5)",
|
||||
splitChunks: "optimization.splitChunks",
|
||||
immutablePaths: "snapshot.immutablePaths",
|
||||
managedPaths: "snapshot.managedPaths",
|
||||
maxModules: "stats.modulesSpace",
|
||||
maxModules: "stats.modulesSpace (BREAKING CHANGE since webpack 5)",
|
||||
hashedModuleIds:
|
||||
'optimization.moduleIds: "hashed" (BREAKING CHANGE since webpack 5)',
|
||||
namedChunks:
|
||||
'optimization.chunkIds: "named" (BREAKING CHANGE since webpack 5)',
|
||||
namedModules:
|
||||
'optimization.moduleIds: "named" (BREAKING CHANGE since webpack 5)',
|
||||
occurrenceOrder:
|
||||
'optimization.chunkIds: "size" and optimization.moduleIds: "size" (BREAKING CHANGE since webpack 5)',
|
||||
automaticNamePrefix:
|
||||
"optimization.splitChunks.[cacheGroups.*].idHint (BREAKING CHANGE since webpack 5)",
|
||||
noEmitOnErrors:
|
||||
"optimization.emitOnErrors (BREAKING CHANGE since webpack 5: logic is inverted to avoid negative flags)"
|
||||
"optimization.emitOnErrors (BREAKING CHANGE since webpack 5: logic is inverted to avoid negative flags)",
|
||||
Buffer:
|
||||
"to use the ProvidePlugin to process the Buffer variable to modules as polyfill\n" +
|
||||
"BREAKING CHANGE: webpack 5 no longer provided Node.js polyfills by default.\n" +
|
||||
"Note: if you are using 'node.Buffer: false', you can just remove that as this is the default behavior now.\n" +
|
||||
"To provide a polyfill to modules use:\n" +
|
||||
'new ProvidePlugin({ Buffer: ["buffer", "Buffer"] }) and npm install buffer.',
|
||||
process:
|
||||
"to use the ProvidePlugin to process the process variable to modules as polyfill\n" +
|
||||
"BREAKING CHANGE: webpack 5 no longer provided Node.js polyfills by default.\n" +
|
||||
"Note: if you are using 'node.process: false', you can just remove that as this is the default behavior now.\n" +
|
||||
"To provide a polyfill to modules use:\n" +
|
||||
'new ProvidePlugin({ process: "process" }) and npm install buffer.'
|
||||
};
|
||||
|
||||
const REMOVED = {
|
||||
concord:
|
||||
"BREAKING CHANGE: resolve.concord has been removed and is no longer avaiable.",
|
||||
devtoolLineToLine:
|
||||
"BREAKING CHANGE: output.devtoolLineToLine has been removed and is no longer avaiable."
|
||||
};
|
||||
/* cSpell:enable */
|
||||
|
||||
|
@ -84,6 +111,15 @@ const validateSchema = (schema, options) => {
|
|||
}?`;
|
||||
}
|
||||
|
||||
if (
|
||||
Object.prototype.hasOwnProperty.call(
|
||||
REMOVED,
|
||||
params.additionalProperty
|
||||
)
|
||||
) {
|
||||
return `${formattedError}\n${REMOVED[params.additionalProperty]}?`;
|
||||
}
|
||||
|
||||
if (!error.dataPath) {
|
||||
if (params.additionalProperty === "debug") {
|
||||
return (
|
||||
|
|
|
@ -498,7 +498,7 @@ describe("Validation", () => {
|
|||
- configuration.output has an unknown property 'ecmaVersion'. These properties are valid:
|
||||
object { assetModuleFilename?, auxiliaryComment?, charset?, chunkFilename?, chunkFormat?, chunkLoadTimeout?, chunkLoading?, chunkLoadingGlobal?, compareBeforeEmit?, crossOriginLoading?, devtoolFallbackModuleFilenameTemplate?, devtoolModuleFilenameTemplate?, devtoolNamespace?, enabledChunkLoadingTypes?, enabledLibraryTypes?, enabledWasmLoadingTypes?, environment?, filename?, globalObject?, hashDigest?, hashDigestLength?, hashFunction?, hashSalt?, hotUpdateChunkFilename?, hotUpdateGlobal?, hotUpdateMainFilename?, iife?, importFunctionName?, importMetaName?, library?, libraryExport?, libraryTarget?, module?, path?, pathinfo?, publicPath?, scriptType?, sourceMapFilename?, sourcePrefix?, strictModuleExceptionHandling?, umdNamedDefine?, uniqueName?, wasmLoading?, webassemblyModuleFilename?, workerChunkLoading?, workerWasmLoading? }
|
||||
-> Options affecting the output of the compilation. \`output\` options tell webpack how to write the compiled files to disk.
|
||||
Did you mean output.environment?"
|
||||
Did you mean output.environment (output.ecmaVersion was a temporary configuration option during webpack 5 beta)?"
|
||||
`)
|
||||
);
|
||||
|
||||
|
|
|
@ -3510,6 +3510,23 @@ declare class Generator {
|
|||
updateHash(hash: Hash, __1: UpdateHashContextGenerator): void;
|
||||
static byType(map?: any): ByTypeGenerator;
|
||||
}
|
||||
declare class GetChunkFilenameRuntimeModule extends RuntimeModule {
|
||||
constructor(
|
||||
contentType: string,
|
||||
name: string,
|
||||
global: string,
|
||||
getFilenameForChunk: (
|
||||
arg0: Chunk
|
||||
) => string | ((arg0: PathData, arg1: AssetInfo) => string),
|
||||
allChunks: boolean
|
||||
);
|
||||
contentType: string;
|
||||
global: string;
|
||||
getFilenameForChunk: (
|
||||
arg0: Chunk
|
||||
) => string | ((arg0: PathData, arg1: AssetInfo) => string);
|
||||
allChunks: boolean;
|
||||
}
|
||||
declare interface GroupConfig<T, R> {
|
||||
getKeys: (arg0: T) => string[];
|
||||
createGroup: (arg0: string, arg1: (T | R)[], arg2: T[]) => R;
|
||||
|
@ -3581,6 +3598,9 @@ declare class HotModuleReplacementPlugin {
|
|||
apply(compiler: Compiler): void;
|
||||
static getParserHooks(parser: JavascriptParser): HMRJavascriptParserHooks;
|
||||
}
|
||||
declare class HotUpdateChunk extends Chunk {
|
||||
constructor();
|
||||
}
|
||||
declare class HttpUriPlugin {
|
||||
constructor();
|
||||
|
||||
|
@ -9961,7 +9981,7 @@ declare namespace exports {
|
|||
};
|
||||
}
|
||||
export namespace runtime {
|
||||
export { LoadScriptRuntimeModule };
|
||||
export { GetChunkFilenameRuntimeModule, LoadScriptRuntimeModule };
|
||||
}
|
||||
export namespace prefetch {
|
||||
export { ChunkPrefetchPreloadPlugin };
|
||||
|
@ -10144,6 +10164,7 @@ declare namespace exports {
|
|||
ExternalModule,
|
||||
ExternalsPlugin,
|
||||
Generator,
|
||||
HotUpdateChunk,
|
||||
HotModuleReplacementPlugin,
|
||||
IgnorePlugin,
|
||||
JavascriptModulesPlugin,
|
||||
|
|
Loading…
Reference in New Issue