如何使Object.assign和传播运算符在所有浏览器上工作?

时间:2018-02-05 19:41:02

标签: webpack

如何使Object.assign工作ie和...传播操作符在所有浏览器上工作。 以下是我的webpack配置文件。

const path = require('path');

module.exports = {
  entry: './index.js',
  output: {
    path: path.join(__dirname, '../../public/admin-portal/js'),
    publicPath: '../../public/admin-portal/js',
    filename: 'app.js'
  },
  plugins: [
  ],
  // support source maps
  devtool: 'inline-source-map',
  module: {
    rules: [
      {
        test: /tinymce[\\/]skins[\\/]/,
        loader: 'file-loader?name=[path][name].[ext]&context=node_modules/tinymce'
      },
      { test: /\.html$/, exclude: /node_modules|bower_components/, use: ['html-loader'] },
      { test: /\.js$/, exclude: /node_modules|bower_components/, use: ['babel-loader?presets=es2015'] },
      { test: /\.css$/, exclude: /node_modules|bower_components/, use: ['style-loader', 'css-loader'] },
      { test: /\.scss$/, exclude: /node_modules|bower_components/, use: ['style-loader', 'css-loader', 'sass-loader'] },
      // // load images (inline base64 URLs for <=30k images)
      { test: /\.(png|svg|jpg|gif)$/, exclude: /node_modules|bower_components/, use: ['url-loader?limit=30720'] }
    ]
  }
};

1 个答案:

答案 0 :(得分:0)

您只需导入core-jses6-shim即可支持Object.assign,但您似乎需要使用babel来获取spread