create-react-app使用

阿里的版本更新太快...每次都有变化,累啊css

一.2017-10-24版本:和vue-cli相似,安装后eject后,生成webpack.config.dev.js,webpack.config.pro.js文件; babel-plugin-import安装实现antd组件按需加载(在webpack.config.dev.js,webpack.config.pro.js文件中修改:vue

{
  test: /\.(js|jsx)$/,
  include: paths.appSrc,
  loader: require.resolve('babel-loader'),
  options: {
      // 后期本身添加plugin
      plugins: [
          ['import', { libraryName: 'antd', style: 'css' }],
      ],
    // This is a feature of `babel-loader` for webpack (not Babel itself).
    // It enables caching results in ./node_modules/.cache/babel-loader/
    // directory for faster rebuilds.
    cacheDirectory: true,
  },

node

注意:1.react@16.0.0和react-dom@16.0.0版本没法使用message方法,所以需将默认版本回退到@15.2.0稳定版react

2.react-router:此时最新版本已经是@4.0.0版,能够降版本降至@2.0.0稳定版。webpack

(回退方法:直接安装目标版本的插件)web

相关文章
相关标签/搜索