-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Reduce runtime as much as possible #9784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
remove some hooks from MainTemplate, move some hooks to CompatRuntimeModule add requireScope RuntimeGlobal
move logic and hooks to JavascriptModulesPlugin
…ule.codeGeneration add code generation phase to Compilation add `output.iife` options to remove iife wrapper add `experiments.outputModule` which enabled `output.module` add `output.module` which sets defaults to `output.iife: false`, `output.libraryTarget: "module"`, `output.jsonpScriptType: "module"`, `terserOptions.module: true` add `output.module` example improve runtime requirements needed by ConcatenatedModule add entry inlining, which inlines entry module code into runtime scope (only when safe) make whole bundle strict when all modules are strict
|
For maintainers only:
|
509d36a to
f08c981
Compare
|
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
|
I've created an issue to document this in webpack/webpack.js.org. |
| module: options.output.module, | ||
| ecma: | ||
| options.output.ecmaVersion > 2000 | ||
| ? options.output.ecmaVersion - 2009 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
options.output.ecmaVersion: 2009 doesn't work as expected and generate invalid ecma version. I think will be great disable usage 20* option for ecmaVersion:
- better schema validation
- some developers can do mistake like
2029or20029 - new version of ecma may not be released every year
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The schema should handle this
webpack/schemas/WebpackOptions.json
Lines 1158 to 1169 in 08dd5ad
| "ecmaVersion": { | |
| "description": "The maximum EcmaScript version of the webpack generated code (doesn't include input source code from modules).", | |
| "anyOf": [ | |
| { | |
| "enum": [5] | |
| }, | |
| { | |
| "type": "number", | |
| "minimum": 2015 | |
| } | |
| ] | |
| }, |
The official ecma version naming is by year. it's ES3 -> ES5 -> ES2015 -> ES2016 -> ...
- some developers can do mistake like
2029or20029
we could add a maximum of i. e. 3000 to catch 20029.
2029 is a valid (not yet released) ecma version, so this seem fine to me.
This PR allows to run webpack without runtime in some cases.
Module.codeGeneration()output.iifeoptions to remove iife wrapperexperiments.outputModulewhich enablesoutput.moduleoutput.modulewhich sets defaults tooutput.iife: false,output.libraryTarget: "module",output.jsonpScriptType: "module",terserOptions.module: trueoutput.libraryTarget: "module"(not yet implemented)output.moduleexampleWhat kind of change does this PR introduce?
refactoring, feature
Did you add tests for your changes?
yes
Does this PR introduce a breaking change?
maybe, but compat-layer added
What needs to be documented once your changes are merged?
output.iifeoptions to remove iife wrapperexperiments.outputModulewhich enabledoutput.moduleandoutput.libraryTarget: "module"(and also enabled them by default)output.modulewhich sets defaults tooutput.iife: false,output.libraryTarget: "module",output.jsonpScriptType: "module",terserOptions.module: trueoutput.libraryTarget: "module"(not yet implemented)