Right now there is no way to override a load
if i set
mix.webpackConfig({
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules\/(?!(vue-strap)\/).*/,
loader: 'babel-loader' + mix.config.babelConfig()
}
]
}
});
nothing will happen and my loader will not get executed since they go by order and the original one defined in mix config will be used.
It took forever to pin it down, but I eventually managed to get ES5 transpiling working with Foundation with the following config:
mix.js('src/app.js', 'public/')
.webpackConfig({
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules(?!\/foundation-sites)|bower_components/,
use: [
{
loader: 'babel-loader',
options: Config.babel()
}
]
}
]
}
});
I'm getting this error after doing what @domstubbs wrote:
webpack.mix.js:13 options: Config.babel()
^
ReferenceError: Config is not defined
Would you mind posting the contents of your webpack.mix.js file?
Same thing here…
let mix = require('laravel-mix');
mix.webpackConfig({
module: {
rules: [{
test: /\.jsx?$/,
exclude: /node_modules(?!\/@<redacted>)/,
use: [{
loader: 'babel-loader',
options: Config.babel()
}]
}]
}
})
Config seems to be passed in via cli arg:
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js
--watch --progress --hide-modules
--config=node_modules/laravel-mix/setup/webpack.config.js
Unless that’s something else? Seems to compile fine on a Mac, but I’m on Windows...
This Config seems to refer to the global Config object. Try using lowercase config, as this is exported by mix:
// node_modules/laravel-mix/src/index.js
…
module.exports = api;
module.exports.mix = api; // Deprecated.
module.exports.config = Config;
Most helpful comment
It took forever to pin it down, but I eventually managed to get ES5 transpiling working with Foundation with the following config: