question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

please fix official doc about using create-react-app

See original GitHub issue

Version

1.2.0

Environment

111

Reproduction link

https://github.com/ant-design/ant-design-mobile/issues/new

Steps to reproduce

111

What is expected?

111

What is actually happening?

222


在 create-react(-native)-app 中使用 中有些没有写对

1,按照官网那样配置完svg会不显示,原因是:除了配置svg-sprite-loader还需要在file-loader中排除svg, 应该是这样才对:

 exclude: [
        ...
        /\.less$/,
        /\.svg$/,
        ...
      ]

2,文档没有写依赖库的安装 yarn add --dev babel-plugin-import svg-sprite-loader@0.3.1 less less-loader postcss-pxtorem

3,需要在webpack.config.dev.js中添加const pxtorem = require('postcss-pxtorem');

最后,官网文档根本跑不通,但是issue中的很多官方回答都是查看官网。。。。。。死循环了

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
roytan883commented, Jun 6, 2017

@paranoidjk 你应该是没用按照在 create-react(-native)-app 中使用 一步一步操作过吧,普通人把引用包缺失错误这种小坑填完以后,知道最后的结果是什么吗???

是所有svg的icon都不显示,不管内置还是外部引用svg,但重点是完全没有任何warning或者error提示

@paranoidjk 你自己翻一翻issue,这种问题被几个人提了,但是你们的答案是叫别人看在 create-react(-native)-app 中使用 ,这不是坑人吗? 看看这些issue: #1320 #1319 #1391

新人能想到要在file-loader加一句exclude: [...,/.svg$/,....]吗?而且网页上也没写svg两次处理的问题,难道所有新人使用antd-mobile的人的正常使用流程是先逛一次issues吗?(而且还要逛issues才知道"svg-sprite-loader"必须用"0.3.1")

1reaction
roytan883commented, Jun 5, 2017

另外,文档关于在create-react-app使用import插件也没有写对,应该是在package.json中配置:

"babel": {
    "presets": [
      "react-app",
    ],
    "plugins": [
      [
        "import",
        [
          {
            "libraryName": "antd-mobile",
            "style": true
          }
        ]
      ]
    ]
  },
Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting Up Your Editor | Create React App
Create React App comes with a bunch of tools that improve the editing experience - if configured correctly. Here's a few tips to...
Read more >
STOP Using Create React App - YouTube
Create React App is a plague and we're here to cure it. Please use Vite, NextJS, or Remix instead. Seriously, anything is better...
Read more >
Template not provided using create-react-app - Stack Overflow
Same here, on Windows npm uninstall -g create-react-app did not solve it. I had to go to the folder C:\Users\serge\AppData\Roaming\npm (your ...
Read more >
How To Set Up a React Project with Create React App
In this step, you'll create a new application using the npm package manager to run a remote script. The script will copy the...
Read more >
How to Install React.js with create-react-app - freeCodeCamp
The installation process may take a few minutes. After it is done, you should see a folder that appears in your workspace with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found