webpack 4.0.0-alpha.1 feedback

Changelog diff from 4.0.0-alpha.0

Big features

  • Upgrade uglifyjs-webpack-plugin to v1
    • ES15 support
  • optimization.minimize has been added to switch minimizing on/off
    • By default: on in production mode, off in development mode
  • optimization.minimizer has been added to configurate minimizers and options
  • CLI has been move to webpack-cli, you need to install webpack-cli to use the CLI
  • The ProgressPlugin (--progress) now displays plugin names
    • At least for plugins migrated to the new plugin system

Features

  • Parser now understand new Foo() expressions
  • Parser can now evaluate **, &, |, ^, >>>, >>, << and ~
  • Rule.ident is now allowed by schema
  • constant replacements now don’t need __webpack_require__ and argument is omitted
  • The concatenated module now generates a bit less code
  • sideEffects can be overriden via module.rules

Bugfixes

  • WebAssembly modules are now correctly threaded as ESM modules and export their exports directly instead of wrapping the content in a default export
  • Extensions are resolved normally in *.mjs again

Breaking changes for Plugin authors

  • Methods on Template are now static
  • A new RuntimeTemplate class has been added and outputOptions and requestShortener has been moved to this class
    • Many methods has been updated to use the RuntimeTemplate instead
    • We plan to move code which accesses the runtime to this new class
  • Module.meta has been replaced with Module.buildMeta
  • Module.buildInfo and Module.factoryMeta have been added
  • Some properties of Module have been moved into the new objects

Please comment if you find additional changes not in the changelog

Author: Fantashit

1 thought on “webpack 4.0.0-alpha.1 feedback

  1. Hi, awesome work 👍.

    When upgrading to webpack 4.0.0-alpha.1 in conjonction with webpack-dev-server 3.0.0-alpha5 (I’ve also added webpack-cli 1.5.2), I get the following error:

    module.js:529
        throw err;
        ^
    
    Error: Cannot find module 'webpack/bin/convert-argv'
        at Function.Module._resolveFilename (module.js:527:15)
        at Function.Module._load (module.js:476:23)
        at Module.require (module.js:568:17)
        at require (internal/module.js:11:18)
        at Object.<anonymous> (/Users/yamafaktory/dev/rust-wasm-webpack/node_modules/webpack-dev-server/cli.js:8:21)
        at Module._compile (module.js:624:30)
        at Object.Module._extensions..js (module.js:635:10)
        at Module.load (module.js:545:32)
        at tryModuleLoad (module.js:508:12)
        at Function.Module._load (module.js:500:3)

    Edit: changing this file https://github.com/webpack/webpack-dev-server/blob/next/cli.js#L8 to

    const convertArgv = require('webpack-cli/bin/convert-argv');

    Fixes it.

    Edit 2: There’s already a PR for that issue https://github.com/webpack/webpack-dev-server/pull/1223/files

Comments are closed.