Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用webpack的Angular2应用程序在边缘浏览器中速度非常慢_Angular_Webpack_Microsoft Edge - Fatal编程技术网

使用webpack的Angular2应用程序在边缘浏览器中速度非常慢

使用webpack的Angular2应用程序在边缘浏览器中速度非常慢,angular,webpack,microsoft-edge,Angular,Webpack,Microsoft Edge,我的angular2应用程序在edge浏览器中速度非常慢。Chrome和Firefox的速度相对较快。当我启用生产模式时,Edge的速度要快得多,但是有没有什么解决办法,而不是使用生产模式。我认为这与“样式加载器”有关。有什么建议吗?两天以来我一直在想这个问题 我的webpack.config文件 var webpack = require('webpack'); var HtmlWebpackPlugin = require('html-webpack-plugin');

我的angular2应用程序在edge浏览器中速度非常慢。Chrome和Firefox的速度相对较快。当我启用生产模式时,Edge的速度要快得多,但是有没有什么解决办法,而不是使用生产模式。我认为这与“样式加载器”有关。有什么建议吗?两天以来我一直在想这个问题

我的webpack.config文件

    var webpack = require('webpack');
    var HtmlWebpackPlugin = require('html-webpack-plugin');
    var ExtractTextPlugin = require('extract-text-webpack-plugin');
    var helpers = require('./helpers');

    module.exports = {
       entry: {
          'polyfills': './src/polyfills.ts',
      'vendor': './src/vendor.ts',
      'app': './src/main.ts'
   },
   // resolves extensionless files by looking for matching files with .ts or .js extensions
   resolve: {
      extensions: ['.ts', '.js']
   },

   module: {
      rules: [
         {
            test: /\.ts$/,
            use: [
               {
                  loader: 'awesome-typescript-loader',
                  options: { configFileName: helpers.root('tsconfig.json') }
               },
               'angular2-template-loader'
            ]
         },
         {
            test: /\.html$/,
            use: 'html-loader'
         },
         {
            test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
            use: 'file-loader?name=assets/[name].[hash].[ext]'
         },
         {
            test: /\.css$/,
            exclude: helpers.root('src', 'app'),
            use: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader?sourceMap' })
         },
         {
            test: /\.css$/,
            include: helpers.root('src', 'app'),
            loader: 'raw-loader'
         },
         {
            test: /\.scss$/,
            use: [
               {
                  loader: "style-loader" // creates style nodes from JS strings
               },
               {
                  loader: "css-loader?sourceMap" // translates CSS into CommonJS
               },
               {
                  loader: "sass-loader?sourceMap" // compiles Sass to CSS
               }
            ]
         }
      ]
   },

   plugins: [
      // Workaround for angular/angular#11580
      new webpack.ContextReplacementPlugin(
         // The (\\|\/) piece accounts for path separators in *nix and Windows
         /angular(\\|\/)core(\\|\/)@angular/,
         helpers.root('./src'), // location of your src
         {} // a map of your routes
      ),

      new webpack.optimize.CommonsChunkPlugin({
         name: ['app', 'vendor', 'polyfills']
      }),

      new HtmlWebpackPlugin({
         template: 'src/index.html'
      }),

      new webpack.ProvidePlugin({
         "window.jQuery": "jquery",
         $: "jquery",
         "jQuery": "jquery",
         "Chart": "chart.js"
      }),
   ]
};

您是否尝试过评测应用程序?感谢您的想法,我尝试过在chrome和edge中评测我的应用程序,es6 shim占用了总时间的40%。我在我的项目中搜索了es6垫片参考,但在哪里都找不到。npm刚刚卸载了es6垫片。现在应用程序运行得更快了。但是css转换仍然非常缓慢。