Skip to content

Instantly share code, notes, and snippets.

@huytrongnguyen
Last active April 8, 2018 02:05
Show Gist options
  • Save huytrongnguyen/41e03513d1a2cd8c2430b213812c857e to your computer and use it in GitHub Desktop.
Save huytrongnguyen/41e03513d1a2cd8c2430b213812c857e to your computer and use it in GitHub Desktop.
import path from 'path';
import webpack from 'webpack';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
export default {
devtool: 'inline-source-map',
entry: {
'js/vendor': [
'@angular/common',
'@angular/compiler',
'@angular/core',
'@angular/platform-browser',
'@angular/platform-browser-dynamic',
'@angular/router',
'rxjs',
'zone.js',
],
'js/app': './src/app.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/dist/',
filename: `[name].js`
},
module: {
loaders: [
{ test: /\.js$/, use: ['babel-loader'], exclude: /node_modules/ },
{ test: /\.html$/, loader: 'raw-loader' },
]
},
plugins: [
new webpack.DefinePlugin({ 'process.env': { NODE_ENV: '"production"' } }),
new webpack.optimize.CommonsChunkPlugin({ name: 'js/vendor', filename: 'js/vendor.js' }),
new webpack.ContextReplacementPlugin(/\@angular(\\|\/)core(\\|\/)esm5/, path.join(__dirname, './client')),
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment