so much searching I found add this: "https://babeljs.io/docs/en/babel-plugin-syntax-optional-chaining" it worked for me
Feb 27, 2020
3
Level 4
Add optional chaining
I want to add optional chaining to my Laravel project. It's a new project, using "laravel-mix": "^5.0.1", (also tried mix 4)
I've followed this: https://babeljs.io/docs/en/next/babel-plugin-proposal-optional-chaining
npm install --save-dev @babel/plugin-proposal-optional-chaining
And this is my .babelrc
{
"plugins": [
"@babel/plugin-proposal-optional-chaining"
]
}
I have also tried adding it to the webpack.mix.js, without success :(
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.babelConfig({
plugins: [
"@babel/plugin-proposal-optional-chaining"
]
});
But I'm still getting invalid expression: Unexpected token .
Am I missing something here? I'm kinda new to Mix
Please or to participate in this conversation.