Skip to content

Document webpack change: Reduce runtime as much as possible #3312

@webpack-bot

Description

@webpack-bot

A pull request by @sokra was merged and maintainers requested a documentation change.

See pull request: webpack/webpack#9784


This PR allows to run webpack without runtime in some cases.

  • remove items from runtime when unneeded
  • add requireScope RuntimeGlobal
  • Deprecate MainTemplate, ChunkTemplate, ModuleTemplate
    • move some hooks to CompatRuntimeModule
    • move logic and hooks to JavascriptModulesPlugin
  • terser defaults inherit ecma version
  • refactor Module.source() and Module.getRuntimeRequirements() into Module.codeGeneration()
  • add code generation phase to Compilation
  • add output.iife options to remove iife wrapper
  • add experiments.outputModule which enables output.module
  • add output.module which sets defaults to output.iife: false, output.libraryTarget: "module", output.jsonpScriptType: "module", terserOptions.module: true
  • add output.libraryTarget: "module" (not yet implemented)
  • 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
  • remove "use strict" from runtime things for bundle size reasons

What 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?

  • add output.iife options to remove iife wrapper
  • add experiments.outputModule which enabled output.module and output.libraryTarget: "module" (and also enabled them by default)
  • add output.module which sets defaults to output.iife: false, output.libraryTarget: "module", output.jsonpScriptType: "module", terserOptions.module: true
  • add output.libraryTarget: "module" (not yet implemented)

Metadata

Metadata

Assignees

No one assigned

    Labels

    webpack5Docs for webpack 5

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions