直接在webpack.config.js oneof下 找到 babel-loader 配置,直接添加antd-mobile配置:
plugins: [
['import', {
libraryName: "antd-mobile",
style: 'css'
}],
[
require.resolve('babel-plugin-named-asset-import'),
{
loaderMap: {
svg: {
ReactComponent: '@svgr/webpack?-svgo,+titleProp,+ref![path]',
},
},
},
],
],
cacheDirectory: true,
报错:.plugins[0][1] must be an object, false, or undefined
根据报错信息描述 plugins数组中子项的第二个元素必须为object, false, or undefined,所以不能使用:
['import', [{
libraryName: "antd-mobile",
style: 'css'
}]],
网友评论