当尝试在React组件中导入以下内容时:
import "bpmn-font/dist/css/bpmn-embedded.css";
我收到以下错误:
ERROR in ./node_modules/bpmn-font/dist/font/bpmn.svg?61125153 10:9
Module parse failed: Unexpected token (10:9)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
* ./node_modules/react-svg-loader/lib/loader.js
You may need an additional loader to handle the result of these loaders.
| props = _objectWithoutProperties(_ref,["styles"]);
|
> return <svg xmlns="http://www.w3.org/2000/svg" {...props} />;
| });
使用以下webpack配置:
{
test: /\.svg$/,use: [
{
loader: "babel-loader"
},{
loader: "react-svg-loader",options: {
jsx: true // true outputs JSX tags
}
}
]
},