These are chat archives for AngularClass/angular2-webpack-starter

15th
Mar 2017
jeewendra kumar
@jeewendrakumar
Mar 15 2017 07:44
Hello Guys. I have a question related to HostListner('window:onresize').Method attached to it getting called on every events on browser. how to restrict it just to resize?.
Ritwik Banerjee
@ritwbanerjee
Mar 15 2017 07:53
can you explicitly call out what you want to do?
gakam clovis
@clovisgakam
Mar 15 2017 08:09
hello i'm new with angular2 and webpack
i have a problem webpack dont handle url in css propely
i have this in my app.component.css
header {
height: 20vh;
background-image: url("../assets/images/lbg.jpg") ;
}
but don't know why webpack don't take the image during the building process
this is content of my webpack configuration file
gakam clovis
@clovisgakam
Mar 15 2017 08:36
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'
  },

  resolve: {
    extensions: ['.ts', '.js']
  },

  module: {
    rules: [
      {
        test: /\.ts$/,
        loaders: [
          {
            loader: 'awesome-typescript-loader',
            options: { configFileName: helpers.root('src', 'tsconfig.json') }
          } , 'angular2-template-loader'
        ]
      },
      {
        test: /\.html$/,
        loader: 'html-loader'
      },
      {
        test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
        loader: 'file-loader?name=assets/img/[name].[hash].[ext]'
      },
      {
        test: /\.css$/,
        exclude: helpers.root('src', 'app'),
        loader: ExtractTextPlugin.extract({ fallback: 'style-loader', loader: 'css-loader?sourceMap' })
      },
      {
        test: /\.css$/,
        include: helpers.root('src', 'app'),
        loader: 'raw-loader'
      }
    ]
  },

  plugins: [
    // Workaround for angular/angular#11580
    new webpack.ContextReplacementPlugin(
      // The (\\|\/) piece accounts for path separators in *nix and Windows
      /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
      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'
    })
  ]
};
Girish Rathod
@RathodGirish
Mar 15 2017 13:35
I am using angular2-google-maps. That is not compatible with AOT.
May I get the solution. I want to reduce my bundle.js file.
I am using this command.
  ng build --prod --aot
niranjan0586
@niranjan0586
Mar 15 2017 14:30
Hi
Is there any anyway to call typescript function from a external javascript
Sarath DR
@sarathdr
Mar 15 2017 16:16
hi is it possible to increase TCP read timeout with angular2 http request
something we set for xhr.timeout = 1000