ziaochina / mk-app-loader

简化原生redux实现状态管理的过程
MIT License
6 stars 8 forks source link

项目使用webpack DDL预打包报错 #1

Open chenyihao2621023 opened 6 years ago

chenyihao2621023 commented 6 years ago

希望通过webpack DDL预打包提高构建速度。但是会报如下错误 error

//webpack,dll.config.js
entry: {
    // ["react", 'react-dom', 'react-redux', 'redux', 'jquery', 'echarts', 'echarts-for-react', 'edf-app-loader', 'immutable', 'moment']
    vendor: ["react", 'react-dom']
  },
  output: {
    path: path.join(__dirname, "/dist/"),
    filename: '[name].js',
    library: '[name]'

  },
plugins: [
    new webpack.DllPlugin({
      path: path.join(__dirname, '.', 'manifest.json'),
      name: '[name]'
    }),
    // 压缩打包的文件,与该文章主线无关
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false
      }
    })
  ]
// webpack.config.js
entry: {
        bundle: ["./index.js", "./assets/styles/index.less"]
    },

    output: {
        path: path.join(__dirname, "/dist/"),
        filename: '[name].[hash:8].bundle.js',
        chunkFilename: '[name].[hash:8].chunk.js'
    },
plugins.push(new webpack.DllReferencePlugin({
    name: 'vendor',
    manifest: require('./manifest.json')
}))

想问下是什么原因呢,大型项目构建速度挺重要的,而且线上环境可以缓存公共js。

ziaochina commented 6 years ago

警告没什么关系,本来原来的也有警告的

chenyihao2621023 commented 6 years ago

40多个警告,看着确实有点难受,可以优化下吗。或者可以请教下我要从哪方面去解决这个问题呢,是从源码入手么

ziaochina commented 6 years ago

您是用了mk-meta-enginee了么还是只用了mk-app-loader?

chenyihao2621023 commented 6 years ago

是准备用您的这一整套框架https://github.com/ziaochina/reactMonkey,所以需要先配下环境

ziaochina commented 6 years ago

警告类错误,是因为框架中给所有组件props传入了一些非必要属性导致,开发环境会报警告,生产环境不会,如果要自己修改需要改mk-meta-engine给组件传属性时删除一些不必要属性,近期工作比较忙,后期应该会去处理这些问题

chenyihao2621023 commented 6 years ago

明白了,比如 delete this.props[noRequire] 对么

ziaochina commented 6 years ago

是的