laravel-elixir-webpack-official
laravel-elixir-webpack-official copied to clipboard
Additional loaders in webpack.config.js
In my project, I had to create my own webpack.config.js
and do some tweaking to get things to work. Really wanted to get away with the default setup, but some 3rd party deps just didn't wanna play ball.
Anyways, I had to include some custom loaders
. I saw the this package does an extend
on the configs, but when you specify the loaders
array it actually overrides them. I came up with an workaround, which seems to do the trick:
// webpack.config.js
Elixir.config.js.webpack.loaders.push({
test: /\.json$/,
loader: 'json'
});
But thought to flag this.
P.S. Great work on Elixir 👍
If someone else with little knowledge of Webpack or Elixir stumbles upon this issue in the future, you can also do something similar with mergeConfig()
:
// webpack.config.js that should be in the root of your project.
Elixir.webpack.mergeConfig({
module: {
loaders: [{
test: /\.json$/,
loader: 'json'
}]
}
})
The source is this SO answer, so you might want to give the guy a thumbs up as well.