var webpack = require('webpack'); var helpers = require('./helpers'); //# Webpack Plugins var CopyWebpackPlugin = (CopyWebpackPlugin = require('copy-webpack-plugin'), CopyWebpackPlugin.default || CopyWebpackPlugin); const HtmlWebpackPlugin = require('html-webpack-plugin'); const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin; var ExtractTextPlugin = require('extract-text-webpack-plugin'); //# Webpack Constants const ENV = process.env.ENV = process.env.NODE_ENV = 'development'; const HMR = helpers.hasProcessFlag('hot'); const METADATA = { title: 'My Application', baseUrl: '/', host: process.env.HOST || '0.0.0.0', port: process.env.PORT || 8080, ENV: ENV, HMR: HMR }; //# Webpack Configuration module.exports = { metadata: METADATA, entry: { 'polyfills': './src/polyfills.ts', 'vendor': './src/vendor.ts', 'main': './src/main.ts', }, resolve: { extensions: ['', '.ts', '.tsx', '.js', '.scss'], root: helpers.root('src'), modulesDirectories: [ 'node_modules', 'server' ] }, module: { preLoaders: [ { test: /\.js$/, loader: 'source-map-loader', exclude: [ helpers.root('node_modules/rxjs'), helpers.root('node_modules/@angular2-material'), helpers.root('node_modules/@angular') ] } ], loaders: [ { test: /\.ts$/, loader: 'awesome-typescript-loader', exclude: [/\.(spec|e2e)\.ts$/] }, { test: /\.json$/, loader: 'json-loader' }, { test: /\.css$/, loader: 'raw-loader' }, { test: /\.html$/, loader: 'raw-loader', exclude: [helpers.root('src/index.html')] }, { test: /\.scss|css$/, loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: 'css-loader!sass-loader' }), exclude: [ helpers.root('node_modules') ] }, { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" }, { test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/, loader : 'file-loader' } ] }, plugins: [ new ForkCheckerPlugin(), new webpack.optimize.OccurrenceOrderPlugin(true), new webpack.optimize.CommonsChunkPlugin({ name: ['polyfills', 'vendor'].reverse() }), new ExtractTextPlugin("[name].css"), new CopyWebpackPlugin([{ from: 'src/assets', to: 'assets' }]), new HtmlWebpackPlugin({ template: 'src/index.html', chunksSortMode: 'dependency' }), new webpack.ProvidePlugin({ jQuery: 'jquery', $: 'jquery', jquery: 'jquery', "Tether": 'tether', "window.Tether": "tether" }) ], node: { global: 'window', crypto: 'empty', module: false, clearImmediate: false, setImmediate: false } };