Angular2 application using webpack is extremely slow in Edge browser

Viewed 588

My angular2 application is extremely slow in edge browser. Chrome and Firefox are comparably faster. When I enabled Production Mode, it is much faster in Edge, but is there any workaround rather than using Production Mode. I figured that it has something to do with "style loader". Any suggestions? I have been trying to figure out this since two days.

My webpack.config file

    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"
      }),
   ]
};
0 Answers
Related