Guest User

Untitled

a guest
Feb 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. const helpers = require('./helpers');
  4. const HtmlWebpackPlugin = require('html-webpack-plugin');
  5. const AotPlugin = require('@ngtools/webpack').AotPlugin;
  6. const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
  7. module.exports = {
  8. entry: {
  9. polyfills: './app/polyfills.ts',
  10. vendor: './app/vendor-aot.ts',
  11. app: './app/boot-aot.ts'
  12. },
  13. output: {
  14. path: helpers.root('dist/aot'),
  15. publicPath: '/',
  16. filename: '[name].bundle.js',
  17. chunkFilename: '[id].chunk.js'
  18. },
  19. resolve: {
  20. extensions: ['.js', '.ts']
  21. },
  22. module: {
  23. loaders: [
  24. {
  25. test: /\.ts$/,
  26. loader: '@ngtools/webpack'
  27. },
  28. {
  29. test: /\.html$/,
  30. loader: 'html-loader'
  31. }
  32. ]
  33. },
  34. plugins: [
  35. new webpack.optimize.CommonsChunkPlugin({
  36. name: ['app', 'vendor', 'polyfills']
  37. }),
  38. // AOT Plugin
  39. new AotPlugin({
  40. tsConfigPath: './tsconfig.aot.json',
  41. entryModule: helpers.root('app/app.module#AppModule')
  42. }),
  43. new HtmlWebpackPlugin({
  44. template: 'config/index.html'
  45. }),
  46. new webpack.optimize.UglifyJsPlugin({
  47. beautify: false,
  48. comments: false,
  49. compress: {
  50. screw_ie8: true,
  51. warnings: false
  52. },
  53. mangle: {
  54. keep_fnames: true,
  55. screw_i8: true
  56. }
  57. }),
  58. new webpack.DefinePlugin({
  59. 'process.env': {
  60. 'ENV': JSON.stringify(ENV)
  61. }
  62. })
  63. ]
  64. };
Add Comment
Please, Sign In to add comment