Laravel Mix Error: ValidationError: "src" is not allowed.
See original GitHub issue─┬ laravel-mix@4.0.14 └── webpack@4.29.3
const mix = require('laravel-mix');
const SVGSpritemapPlugin = require('svg-spritemap-webpack-plugin');
// Set up the spritemap plugin
mix.webpackConfig({
plugins: [
new SVGSpritemapPlugin({
src:'assets/svg/icons/*.svg',
filename: '/svg/icons.svg',
prefix: '',
svg4everybody: true,
svgo: {
removeTitle: true,
removeStyleElement: true,
cleanupNumericValue: true,
},
})
]
});
// Adapt laravel-mix webpack config to better handle svg images.
Mix.listen('configReady', (webpackConfig) => {
// Add separate svg loader
webpackConfig.module.rules.push({
test: /\.(svg)$/,
include: /assets\/svg/,
loaders: [
{
loader: 'file-loader',
options: {
name: 'svg/[name].[ext]?[hash]',
publicPath: Config.resourceRoot
}
},
{
loader: 'img-loader',
options: Config.imgLoaderOptions
}
]
});
// Exclude local 'svg' folder from font loader
let fontLoaderConfig = webpackConfig.module.rules.find(rule => String(rule.test) === String(/\.(woff2?|ttf|eot|svg|otf)$/))
fontLoaderConfig.exclude = /(assets\/svg)/;
});
Error: ValidationError: “src” is not allowed. “filename” is not allowed. “prefix” is not allowed. “svg4everybody” is not allowed. “svgo” is not allowed
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Laravel Mix: ValidationError: CSS Loader has been initialized ...
As a workaround, downgrade your css-loader package to a 5.x version. npm install css-loader@5.2.7 --save-dev.
Read more >Validation - Laravel - The PHP Framework For Web Artisans
In this example, we are specifying that the publish_at field may be either null or a valid date representation. If the nullable modifier...
Read more >JavaScript | Laravel Mix Documentation
mix. js(src | [src], output); With a single line of code, Laravel Mix allows you to trigger a number of vital actions.
Read more >Build Error with Windows: Validation Error - bud
I saw someone did a fork to use Laravel Mix instead of Bud, which I think might work fine and not require WSL?...
Read more >Laravel 8.x Compiling Assets (Mix) - ReaDouble
If you've ever been confused and overwhelmed about getting started with webpack and asset compilation, you will love Laravel Mix. However, you are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found one of the solutions. We have to add this options
output: { chunk: { keep: true } },
Thx @ziqq You save my day !!!