Is there some way to pass parameters to the laravel mix via the command line and get them in the webpack.mix.js file? For example, I added the line frontend-dev, but I can't get the "foo" variable after running "yarn run frontend-dev".
package.json
{
"private": true,
"scripts": {
"development": "mix",
"frontend-dev": "mix -- --env foo=frontend"
},
"devDependencies": {
"axios": "^0.21",
"laravel-mix": "^6.0.6",
"lodash": "^4.17.19",
"postcss": "^8.1.14"
}
}
webpack.mix.js
const mix = require('laravel-mix');
//console.log(process.env);
console.log(process.env.foo); //output: undefined
$ mix --production --ieCompat=true error: unknown option '--ieCompat=true'
and$ mix --production -- --ieCompat=true [webpack-cli] Error: Unknown option '--ieCompat=true'
– Venetian