Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- node node_modules/webpack/bin/webpack.js --mode=production --env.prod
- Hash: 7b126cdcbdda85d6b0f304152e501136ec85ed58
- Version: webpack 4.6.0
- Child
- Hash: 7b126cdcbdda85d6b0f3
- Time: 13298ms
- Built at: 2018-04-23 12:27:51
- 1 asset
- Entrypoint main-client = main-client.js
- ERROR in window is not defined
- Child
- Hash: 04152e501136ec85ed58
- Time: 13281ms
- Built at: 2018-04-23 12:27:51
- 1 asset
- Entrypoint main-server = main-server.js
- ERROR in window is not defined
- const path = require('path');
- const webpack = require('webpack');
- const merge = require('webpack-merge');
- const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
- const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
- var nodeExternals = require('webpack-node-externals');
- const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
- module.exports = (env) => {
- // Configuration in common to both client-side and server-side bundles
- const isDevBuild = !(env && env.prod);
- //mode: isDevBuild ? 'development' : 'production';
- mode: 'development';
- const sharedConfig = {
- stats: { modules: false },
- context: __dirname,
- resolve: { extensions: ['.js', '.ts'] },
- output: {
- filename: '[name].js',
- publicPath: 'dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
- },
- module: {
- rules: [
- { test: /.ts$/, include: /ClientApp/, use: isDevBuild ? ['awesome-typescript-loader?silent=true', 'angular2-template-loader', 'angular2-router-loader'] : '@ngtools/webpack' },
- { test: /.html$/, use: 'html-loader?minimize=false' },
- { test: /.css$/, use: ['to-string-loader', 'style-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize'] },
- { test: /.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' },
- //font management
- {
- test: /.(svg|eot|ttf|woff|woff2)$/,
- use: [{
- loader: 'file-loader',
- options: {
- name: 'images/[name].[hash].[ext]'
- }
- }]
- }
- ]
- },
- plugins: [new CheckerPlugin()]
- };
- // Configuration for client-side bundle suitable for running in browsers
- const clientBundleOutputDir = './wwwroot/dist';
- const clientBundleConfig = merge(sharedConfig, {
- entry: { 'main-client': './ClientApp/boot.browser.ts' },
- output: { path: path.join(__dirname, clientBundleOutputDir) },
- optimization: {
- minimizer: [
- // specify a custom UglifyJsPlugin here to get source maps in production
- new UglifyJsPlugin({
- cache: true,
- parallel: true,
- uglifyOptions: {
- compress: false,
- ecma: 6,
- mangle: true
- },
- sourceMap: true
- })
- ]
- },
- plugins: [
- new webpack.DllReferencePlugin({
- context: __dirname,
- manifest: require('./wwwroot/dist/vendor-manifest.json')
- })
- ].concat(isDevBuild ? [
- // Plugins that apply in development builds only
- new webpack.SourceMapDevToolPlugin({
- filename: '[file].map', // Remove this line if you prefer inline source maps
- moduleFilenameTemplate: path.relative(clientBundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
- })
- ] : [
- new AngularCompilerPlugin({
- tsConfigPath: './tsconfig.json',
- entryModule: path.join(__dirname, 'ClientApp/app/app.browser.module#AppModule'),
- exclude: ['./**/*.server.ts']
- })
- ])
- });
- // Configuration for server-side (prerendering) bundle suitable for running in Node
- const serverBundleConfig = merge(sharedConfig, {
- resolve: { mainFields: ['main'] },
- entry: { 'main-server': './ClientApp/boot.server.ts' },
- plugins: [
- new webpack.DllReferencePlugin({
- context: __dirname,
- manifest: require('./ClientApp/dist/vendor-manifest.json'),
- sourceType: 'commonjs2',
- name: './vendor'
- })
- ].concat(isDevBuild ? [] : [
- new AngularCompilerPlugin({
- tsConfigPath: './tsconfig.json',
- entryModule: path.join(__dirname, 'ClientApp/app/app.server.module#AppModule'),
- exclude: ['./**/*.browser.ts']
- })
- ]),
- output: {
- libraryTarget: 'commonjs',
- path: path.join(__dirname, './ClientApp/dist')
- },
- target: 'node',
- externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
- devtool: 'inline-source-map'
- });
- return [clientBundleConfig, serverBundleConfig];
- };
Add Comment
Please, Sign In to add comment