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

webpack 4.0.0-alpha.1 feedback #6132

Closed
sokra opened this Issue Dec 14, 2017 · 10 comments

Comments

Projects
None yet
7 participants
@sokra
Member

sokra commented Dec 14, 2017

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

@yamafaktory

This comment has been minimized.

yamafaktory commented Dec 14, 2017

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

@TheLarkInn

This comment has been minimized.

Member

TheLarkInn commented Dec 15, 2017

Linking over #6135

@phyllisstein

This comment has been minimized.

phyllisstein commented Dec 16, 2017

Looks like the plugin call is still not working as expected with MultiCompiler; it's currently causing issues with webpack-dev-middleware's support for multiple compiler instances, as noted in this comment and this issue. My Webpack config and other germane details are linked from both of those comments, but I'm happy to provide more color if it's useful. Thanks!

@TheLarkInn

This comment has been minimized.

Member

TheLarkInn commented Dec 16, 2017

Thank you very much for the report @phyllisstein

@sompylasar

This comment has been minimized.

sompylasar commented Dec 18, 2017

amireh/happypack#200
Looks like one more breaking change: compiler.resolvers.loader.resolve is undefined.


EDIT: Found something related that was briefly mentioned in 4.0.0-alpha.0 changelog:

Moved Compiler.resolvers into Compiler.resolverFactory accessible with plugins.

but compiler.resolvers doesn't seem to be undefined.

@sokra

This comment has been minimized.

Member

sokra commented Dec 18, 2017

but compiler.resolvers doesn't seem to be undefined.

There is a kind of compat layer on compiler.resolvers.

@TheLarkInn

This comment has been minimized.

Member

TheLarkInn commented Dec 19, 2017

Adding #6157

@peter-mouland

This comment has been minimized.

peter-mouland commented Dec 20, 2017

I've just created this issue within webpack-cli, seems like it might be related to the optimization.minimize options now on by default, but the cli still expects the file to exist within webpack.

So because the cli is now the only way to use webpack, am I correct in thinking webpack is broken by default?

var UglifyJsPlugin = require("webpack/lib/optimize/UglifyJsPlugin"); 

https://github.com/webpack/webpack-cli/blob/2402117ae70ce709b059c60026267f7707becb22/bin/convert-argv.js#L512

webpack/webpack-cli#221

Please disregard this comment - have raised (which has already been closed 👍) an issue here #6162)

@donaldpipowitch

This comment has been minimized.

donaldpipowitch commented Dec 22, 2017

An answer to @machineloop from the last alpha:

I'm getting the following when I bump up to v4 Alpha, what's the best way to figure out which plugin is breaking?

Running "webpack:build" (webpack) task
Warning: this.compiler.applyPluginsAsync is not a function Used --force, continuing.
(node:59256) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
(node:59256) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead

You can run $ node --trace-deprecation ./node_modules/.bin/webpack. Now you get something like this (my stacktrace from this example):

(node:52664) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead
    at webpack (./node_modules/webpack/lib/webpack.js:31:19)
    at ...
(node:52664) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
    at HtmlWebpackPlugin.apply (./node_modules/html-webpack-plugin/index.js:59:12)
    at ...
(node:52664) DeprecationWarning: The callback argument was splitted into resolveContext and callback.
    at Resolver.resolve (./node_modules/enhanced-resolve/lib/Resolver.js:139:15)
    at ...
@sokra

This comment has been minimized.

Member

sokra commented Dec 22, 2017

new version: #6179

@sokra sokra closed this Dec 22, 2017

@webpack webpack locked as resolved and limited conversation to collaborators Dec 22, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.