var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {

  entry: './public/main.ts',
  output: {
    path: './dist',
    filename: 'app.bundle.js'
  },
  module: {
    loaders: [
      {test: /\.ts$/, loader: 'ts'},
      {test: /\.html$/, loader: 'raw'},
      {test: /\.css$/, loader: 'raw'},
    
      {test: /\.png!.jpg!.gif$/, loader: 'url'},
      {
  test: /\.scss$/,
  loaders: ["style-loader", "css-loader", "sass-loader"]
}
    ]
  },
  devtool: "#source-map",
  resolve: {
    extensions: ['', '.js', '.ts', '.html', '.css','.sass']
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './public/index.html'
    }),
    new webpack.DefinePlugin({
      app: {
        environment: JSON.stringify(process.env.APP_ENVIRONMENT || 'development')
      }
    }),
     new CopyWebpackPlugin([
      { from: './public/assets/', to: './assets/' }
      
    ])
  ]

};
