Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

No way to specify webpack 4 "mode" in WebpackDevMiddlewareOptions? #1595

Description

@jakelauer

I am getting this warning when using WebpackDevMiddleware:

[HMR] bundle has 4 warnings
configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.

I am not seeing a way to specify this flag from WebpackDevMiddlewareOptions. Am I missing something?

Activity

  1. bharney commented on Mar 29, 2018

    @bharney

    I handled it by just setting mode in both webpack.config files. Below is what I have in the shared portion of each config file.

    const sharedConfig = () => ({
            mode: isDevBuild ? 'development' : 'production',
            stats: { modules: false },
    

    That cleared the warning up for me without much change to the configuration. Hope this helps!

  2. salixzs commented on Apr 1, 2018

    @salixzs

    To update to WebPack 4, --mode should be specified somehow always, so it may ask for some more drastic changes in all JavaScriptServices and/or middlewares.

    --mode development will not do uglifying, map-ing, bundling, cherry-picking and other things it now does automatically for --mode production­. And moreover - production mode now is default (if not speficied). Could be good if JavaScript services could be updated to support Webpack 4, so we get development more goodness with it. As additional - webpack 4 is reported to be considerably faster than previous versions.

    Article on Medium.
    Another article

    On sad note - there are some popular plugins, which got broken on webpack 4, like extract-text-webpack-plugin (now has 4.0.0 alpha release).

  3. SteveSandersonMS commented on Apr 3, 2018

    @SteveSandersonMS
    Member

    Webpack 4 support is covered by #1562

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions