question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 5 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
ziqqcommented, Sep 11, 2019

@jedybeavis could you share an updated configuration? mix.version() doesn’t get along with this package. Error: ENOENT: no such file or directory, open 'xyz\spritemap.js'

Same here, Error: ENOENT: no such file or directory, open 'xyz\spritemap.js'

I found one of the solutions. We have to add this options output: { chunk: { keep: true } },

0reactions
mco67commented, May 5, 2021

@jedybeavis could you share an updated configuration? mix.version() doesn’t get along with this package. Error: ENOENT: no such file or directory, open 'xyz\spritemap.js'

Same here, Error: ENOENT: no such file or directory, open 'xyz\spritemap.js'

I found one of the solutions. We have to add this options output: { chunk: { keep: true } },

Thx @ziqq You save my day !!!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found