美文网首页
create-react-app 引入antd-mobile,提

create-react-app 引入antd-mobile,提

作者: 55lover | 来源:发表于2019-11-11 10:10 被阅读0次

    直接在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'
     }]],
    

    相关文章

      网友评论

          本文标题:create-react-app 引入antd-mobile,提

          本文链接:https://www.haomeiwen.com/subject/gngzbctx.html