Laravel-mix: Warrning when watching You are running the esm-bundler build of Vue...

Created on 20 Mar 2021  路  2Comments  路  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 6.0.13
  • Node Version (node -v): v14.15.5
  • NPM Version (npm -v): 6.14.11
  • OS: OSX BigSur

Description:

Should I care about this warning when running npm run watch?

You are running the esm-bundler build of Vue. It is recommended to configure your bundler to explicitly replace feature flag globals with boolean literals to get proper tree-shaking in the final bundle.

Not quite sure what it telling me. This message is;t visible on the production build but still want to get rid of it.

bug

Most helpful comment

Here's how you get rid of it

mix.js("resources/js/app.js", "public/js")
    .vue({ version: 3 })
    .webpackConfig((webpack) => {
        return {
            plugins: [
                new webpack.DefinePlugin({
                    __VUE_OPTIONS_API__: true,
                    __VUE_PROD_DEVTOOLS__: false,
                }),
            ],
        };
    })

All 2 comments

Oh, right yeah we should set the necessary defines when using .vue() and Vue 3. Good catch.

Here's how you get rid of it

mix.js("resources/js/app.js", "public/js")
    .vue({ version: 3 })
    .webpackConfig((webpack) => {
        return {
            plugins: [
                new webpack.DefinePlugin({
                    __VUE_OPTIONS_API__: true,
                    __VUE_PROD_DEVTOOLS__: false,
                }),
            ],
        };
    })
Was this page helpful?
0 / 5 - 0 ratings

Related issues

mementoneli picture mementoneli  路  3Comments

Bomavi picture Bomavi  路  3Comments

terion-name picture terion-name  路  3Comments

jpmurray picture jpmurray  路  3Comments

Micaso picture Micaso  路  3Comments