Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

antd-mobile按需加载 The "injectBabelPlugin" helper has been deprecated as of v2.0 #3094

Closed
1 task
Calinas opened this issue Feb 23, 2019 · 4 comments · Fixed by #3132
Closed
1 task

Comments

@Calinas
Copy link

Calinas commented Feb 23, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://mobile.ant.design/docs/react/introduce-cn

Steps to reproduce

按照文档安装babel-plugin-import 之后,npm start之后无法启动服务。报错:The "injectBabelPlugin" helper has been deprecated as of v2.0. You can use customize-cra plugins in replacement - https://github.com/arackaf/customize-cra#available-plugins。 injectBabelPlugin已经不支持了,要换成customize-cra。

What is expected?

希望文档更新一下。config-overrides.js配置如下:

const {
  override,
  fixBabelImports
} = require("customize-cra");

module.exports = override(
  fixBabelImports("babel-plugin-import", {
    libraryName: "antd-mobile",
    style: "css"
  })
);

What is actually happening?

The "injectBabelPlugin" helper has been deprecated as of v2.0. You can use customize-cra plugins in replacement

Environment Info
antd 2.2.6
React 16.8.3
System 不涉及
Browser 不涉及

实际版本2.2.9

@arfaWong
Copy link

yarn add less
yarn add --dev react-app-rewired customize-cra less-loader 
// config-overrides.js

const {
  addLessLoader,
  fixBabelImports,
  override
} = require("customize-cra");

module.exports = {
  webpack: override(
    addLessLoader({
      javascriptEnabled: true
    }),
    fixBabelImports("babel-plugin-import", {
      libraryName: "antd-mobile",
      style: true
    })
  )
};

@jsxiao
Copy link

jsxiao commented Mar 30, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://mobile.ant.design/docs/react/introduce-cn

Steps to reproduce

按照文档安装babel-plugin-import 之后,npm start之后无法启动服务。报错:The "injectBabelPlugin" helper has been deprecated as of v2.0. You can use customize-cra plugins in replacement - https://github.com/arackaf/customize-cra#available-plugins。 injectBabelPlugin已经不支持了,要换成customize-cra。

What is expected?

希望文档更新一下。config-overrides.js配置如下:

const {
  override,
  fixBabelImports
} = require("customize-cra");

module.exports = override(
  fixBabelImports("babel-plugin-import", {
    libraryName: "antd-mobile",
    style: "css"
  })
);

What is actually happening?

The "injectBabelPlugin" helper has been deprecated as of v2.0. You can use customize-cra plugins in replacement

Environment Info
antd 2.2.6
React 16.8.3
System 不涉及
Browser 不涉及
实际版本2.2.9

非常感谢提供的解决办法!

@meijiangyan
Copy link

const {
override,
fixBabelImports
} = require("customize-cra");

module.exports = override(
fixBabelImports("babel-plugin-import", {
libraryName: "antd-mobile",
style: "css"
})
);

thanks

@meiminjun
Copy link

style-loader 升级了,导致dev 环境antd-mobile 按需引入的样式获取不到,降级即可,bye bye!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants