Level 2
Hi, @pweil , try to use OR operator || instead of ??
I'm using Laravel Mix 6.0.32. I'm getting the following error when I run npm run dev:
[webpack-cli] /Users/pweil/code/wisconsin-idea/webpack.mix.js:25
this.watch = config.watch ?? ['routes/**/*.php'];
^
SyntaxError: Unexpected token '?
at new Script (vm.js:88:7)
at NativeCompileCache._moduleCompile (/Users/pweil/code/wisconsin-idea/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
at Module._compile (/Users/pweil/code/wisconsin-idea/node_modules/v8-compile-cache/v8-compile-cache.js:184:36)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (/Users/pweil/code/wisconsin-idea/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at module.exports (/Users/pweil/code/wisconsin-idea/node_modules/laravel-mix/setup/webpack.config.js:8:5)
at loadConfigByPath (/Users/pweil/code/wisconsin-idea/node_modules/webpack-cli/lib/webpack-cli.js:1760:27)
In my mix file I have some code to watch route changes that uses the ?? operator:
mix.extend('ziggy', new class {
register(config = {}) {
this.watch = config.watch ?? ['routes/**/*.php'];
this.path = config.path ?? '';
this.enabled = config.enabled ?? !mix.inProduction();
[...]
What might be causing this error? Webpack 5 is supposed to support this syntax.
Please or to participate in this conversation.