0

I am getting this error:

app.js?id=37395f80948d4d99f537:2 Uncaught ReferenceError: VUE_PROD_DEVTOOLS is not defined at Module.5166 (app.js?id=37395f80948d4d99f537:2)

When I run a new Laravel 8 install with Jetstream, having run npm run prod. It works fine with npm run dev. Home page will not render at all with the prod version. I have the Vue dev tools extension in Chrome installed, with the allow access to file URLs option turned on.

1
  • I have the same problem! Commented Feb 27, 2021 at 5:13

2 Answers 2

2

I ran into this same error, and was able to resolve it by ensuring 'webpack.config.js' has the following:

const webpack = require('webpack')

module.exports = {
plugins: [
new webpack.DefinePlugin({
__VUE_PROD_DEVTOOLS__: 'false'
})
],
};

This is in addition to whatever else you have in your webpack.config.js file.

Also note that npm run prod may be different than npm run production

I found this solution at https://github.com/visualfanatic/vue-svg-loader/issues/136

Sign up to request clarification or add additional context in comments.

Comments

1

Both George Brotherston and WeAreModus from Laracasts are right, fbloggs.

When using Vue 3.0.0-rc.3 you need to set __VUE_PROD_DEVTOOLS__ explicitly.

This bug fixed in v3.0.7.

See Github issue resolution


See docs

Bundler Build Feature Flags Starting with 3.0.0-rc.3, esm-bundler builds now exposes global feature flags that can be overwritten at compile time:

VUE_OPTIONS_API (enable/disable Options API support, default: true)

VUE_PROD_DEVTOOLS (enable/disable devtools support in production, default: false) The build will work without configuring these flags, however it is strongly recommended to properly configure them in order to get proper tree-shaking in the final bundle. To configure these flags:

webpack: use DefinePlugin

Rollup: use @rollup/plugin-replace

Vite: configured by default, but can be overwritten using the define option

Note: the replacement value must be boolean literals and cannot be strings, otherwise the bundler/minifier will not be able to properly evaluate the conditions.

1 Comment

Thanks. I accepted the other answer, although I appreciate you showing me this in the docs. I do still think this is a bug - the docs you quote clearly state 'the build will work without configuring these flags' - and I don't see why it should work in dev but not prod. Clearly the default of false is not defined.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.