SVG内联时出现webpack.optimize.UglifyJsPlugin错误

时间:2016-05-24 10:32:35

标签: webpack

我有正确的CSS内联SVG图像。尝试缩小此文件时会出现错误:

  

模块构建失败:ModuleBuildError:模块构建失败:       在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       在context.callback(/home/ldy/company-project/liveneeq-webview/node_modules/webpack/node_modules/webpack-core/lib/NormalModuleMixin.js:148:14)       在对象。 (/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       在runMicrotasksCallback(node.js:327:7)       at nextTickCallbackWith0Args(node.js:420:9)       at process._tickCallback(node.js:349:13)

Webpack选项:

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

Css代码:

.mui-spinner: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=\'%236c6c6c\' 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>');
}

感谢您的帮助。

=============================================== ====

编辑

这是一个错误; https://github.com/webpack/webpack/issues/2571

0 个答案:

没有答案