Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack.optimize.UglifyJsPlugin error when SVG inlined #2571

Closed
liu-dongyu opened this issue May 30, 2016 · 3 comments
Closed

webpack.optimize.UglifyJsPlugin error when SVG inlined #2571

liu-dongyu opened this issue May 30, 2016 · 3 comments
Labels

Comments

@liu-dongyu
Copy link

I have the correct SVG image inlined to CSS. When trying minify this file gets error:

Module build failed: ModuleBuildError: Module build failed:
at DependenciesBlock.onModuleBuildFailed (/home/ldy/company-project/liveneeq-webview/node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:315:19)
at nextLoader (/home/ldy/company-project/liveneeq-webview/node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:270:31)
at /home/ldy/company-project/liveneeq-webview/node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:292:15
at context.callback (/home/ldy/company-project/liveneeq-webview/node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:148:14)
at Object. (/home/ldy/company-project/liveneeq-webview/node_modules/css-loader/lib/loader.js:32:18)
at /home/ldy/company-project/liveneeq-webview/node_modules/css-loader/lib/processCss.js:211:3
at runMicrotasksCallback (node.js:327:7)
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)

Webpack option:

    new webpack.optimize.UglifyJsPlugin({
        sourceMap: false,
        minimize: true,
        compress: {
            drop_debugger: true,
            warnings: false,
            drop_console: true
        }
    })

Css code:

.mui-spinner-white:after {
    background-image: url('data:image/svg+xml;charset=utf-8,<svg viewBox=\'0 0 120 120\' xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\'><defs><line id=\'l\' x1=\'60\' x2=\'60\' y1=\'7\' y2=\'27\' stroke=\'%23fff\' stroke-width=\'11\' stroke-linecap=\'round\'/></defs><g><use xlink:href=\'%23l\' opacity=\'.27\'/><use xlink:href=\'%23l\' opacity=\'.27\' transform=\'rotate(30 60,60)\'/><use xlink:href=\'%23l\' opacity=\'.27\' transform=\'rotate(60 60,60)\'/><use xlink:href=\'%23l\' opacity=\'.27\' transform=\'rotate(90 60,60)\'/><use xlink:href=\'%23l\' opacity=\'.27\' transform=\'rotate(120 60,60)\'/><use xlink:href=\'%23l\' opacity=\'.27\' transform=\'rotate(150 60,60)\'/><use xlink:href=\'%23l\' opacity=\'.37\' transform=\'rotate(180 60,60)\'/><use xlink:href=\'%23l\' opacity=\'.46\' transform=\'rotate(210 60,60)\'/><use xlink:href=\'%23l\' opacity=\'.56\' transform=\'rotate(240 60,60)\'/><use xlink:href=\'%23l\' opacity=\'.66\' transform=\'rotate(270 60,60)\'/><use xlink:href=\'%23l\' opacity=\'.75\' transform=\'rotate(300 60,60)\'/><use xlink:href=\'%23l\' opacity=\'.85\' transform=\'rotate(330 60,60)\'/></g></svg>');
}

http://stackoverflow.com/questions/37411026/webpack-optimize-uglifyjsplugin-error-when-svg-inlined

@bebraw bebraw added the bug label May 30, 2016
@bebraw
Copy link
Contributor

bebraw commented Dec 24, 2016

Can you check against webpack 2?

@xxssww0258
Copy link

css-loader 解析url的svg标签就会报错,不知道楼主这个问题怎么解决

@alexander-akait
Copy link
Member

Problem in css-loader not UglifyJsPlugin (see webpack-contrib/css-loader#615)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants