dvandalen's avatar

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

0 likes
3 replies
RafaelGrube's avatar

@duard.bol@gmail.com Unfortunately the page is giving an error 404. If you remember and can, share with us your configuration. Thank you very much

Please or to participate in this conversation.