Guest User

Untitled

a guest
Apr 23rd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.12 KB | None | 0 0
  1. node node_modules/webpack/bin/webpack.js --mode=production --env.prod
  2.  
  3. Hash: 7b126cdcbdda85d6b0f304152e501136ec85ed58
  4. Version: webpack 4.6.0
  5. Child
  6. Hash: 7b126cdcbdda85d6b0f3
  7. Time: 13298ms
  8. Built at: 2018-04-23 12:27:51
  9. 1 asset
  10. Entrypoint main-client = main-client.js
  11.  
  12. ERROR in window is not defined
  13. Child
  14. Hash: 04152e501136ec85ed58
  15. Time: 13281ms
  16. Built at: 2018-04-23 12:27:51
  17. 1 asset
  18. Entrypoint main-server = main-server.js
  19.  
  20. ERROR in window is not defined
  21.  
  22. const path = require('path');
  23. const webpack = require('webpack');
  24. const merge = require('webpack-merge');
  25. const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
  26. const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
  27. var nodeExternals = require('webpack-node-externals');
  28. const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
  29.  
  30. module.exports = (env) => {
  31. // Configuration in common to both client-side and server-side bundles
  32. const isDevBuild = !(env && env.prod);
  33.  
  34. //mode: isDevBuild ? 'development' : 'production';
  35. mode: 'development';
  36.  
  37. const sharedConfig = {
  38. stats: { modules: false },
  39. context: __dirname,
  40. resolve: { extensions: ['.js', '.ts'] },
  41. output: {
  42. filename: '[name].js',
  43. publicPath: 'dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
  44. },
  45. module: {
  46. rules: [
  47. { test: /.ts$/, include: /ClientApp/, use: isDevBuild ? ['awesome-typescript-loader?silent=true', 'angular2-template-loader', 'angular2-router-loader'] : '@ngtools/webpack' },
  48. { test: /.html$/, use: 'html-loader?minimize=false' },
  49. { test: /.css$/, use: ['to-string-loader', 'style-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize'] },
  50. { test: /.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' },
  51. //font management
  52. {
  53. test: /.(svg|eot|ttf|woff|woff2)$/,
  54. use: [{
  55. loader: 'file-loader',
  56. options: {
  57. name: 'images/[name].[hash].[ext]'
  58. }
  59. }]
  60. }
  61. ]
  62. },
  63. plugins: [new CheckerPlugin()]
  64. };
  65.  
  66. // Configuration for client-side bundle suitable for running in browsers
  67. const clientBundleOutputDir = './wwwroot/dist';
  68. const clientBundleConfig = merge(sharedConfig, {
  69. entry: { 'main-client': './ClientApp/boot.browser.ts' },
  70. output: { path: path.join(__dirname, clientBundleOutputDir) },
  71. optimization: {
  72. minimizer: [
  73. // specify a custom UglifyJsPlugin here to get source maps in production
  74. new UglifyJsPlugin({
  75. cache: true,
  76. parallel: true,
  77. uglifyOptions: {
  78. compress: false,
  79. ecma: 6,
  80. mangle: true
  81. },
  82. sourceMap: true
  83. })
  84. ]
  85. },
  86. plugins: [
  87. new webpack.DllReferencePlugin({
  88. context: __dirname,
  89. manifest: require('./wwwroot/dist/vendor-manifest.json')
  90. })
  91. ].concat(isDevBuild ? [
  92. // Plugins that apply in development builds only
  93. new webpack.SourceMapDevToolPlugin({
  94. filename: '[file].map', // Remove this line if you prefer inline source maps
  95. moduleFilenameTemplate: path.relative(clientBundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
  96. })
  97. ] : [
  98. new AngularCompilerPlugin({
  99. tsConfigPath: './tsconfig.json',
  100. entryModule: path.join(__dirname, 'ClientApp/app/app.browser.module#AppModule'),
  101. exclude: ['./**/*.server.ts']
  102. })
  103. ])
  104. });
  105.  
  106. // Configuration for server-side (prerendering) bundle suitable for running in Node
  107. const serverBundleConfig = merge(sharedConfig, {
  108. resolve: { mainFields: ['main'] },
  109. entry: { 'main-server': './ClientApp/boot.server.ts' },
  110. plugins: [
  111. new webpack.DllReferencePlugin({
  112. context: __dirname,
  113. manifest: require('./ClientApp/dist/vendor-manifest.json'),
  114. sourceType: 'commonjs2',
  115. name: './vendor'
  116. })
  117. ].concat(isDevBuild ? [] : [
  118. new AngularCompilerPlugin({
  119. tsConfigPath: './tsconfig.json',
  120. entryModule: path.join(__dirname, 'ClientApp/app/app.server.module#AppModule'),
  121. exclude: ['./**/*.browser.ts']
  122. })
  123. ]),
  124. output: {
  125. libraryTarget: 'commonjs',
  126. path: path.join(__dirname, './ClientApp/dist')
  127. },
  128.  
  129. target: 'node',
  130. externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
  131. devtool: 'inline-source-map'
  132. });
  133. return [clientBundleConfig, serverBundleConfig];
  134. };
Add Comment
Please, Sign In to add comment