@@ -2,22 +2,17 @@ const path = require('path');
22const webpack = require ( 'webpack' ) ;
33const ExtractTextPlugin = require ( 'extract-text-webpack-plugin' ) ;
44const CheckerPlugin = require ( 'awesome-typescript-loader' ) . CheckerPlugin ;
5- const VueSSRPlugin = require ( 'vue-ssr-webpack-plugin' ) ;
6- const merge = require ( 'webpack-merge' ) ;
75const bundleOutputDir = './wwwroot/dist' ;
86
97module . exports = ( env ) => {
108 const isDevBuild = ! ( env && env . prod ) ;
119
12- // Configuration in common to both client-side and server-side bundles
13- const sharedConfig = {
10+ const bundleOutputDir = './wwwroot/dist' ;
11+ return [ {
1412 stats : { modules : false } ,
1513 context : __dirname ,
1614 resolve : { extensions : [ '.js' , '.ts' ] } ,
17- output : {
18- filename : '[name].js' ,
19- publicPath : '/dist/'
20- } ,
15+ entry : { 'main' : './ClientApp/boot.ts' } ,
2116 module : {
2217 rules : [
2318 { test : / \. v u e \. h t m l $ / , include : / C l i e n t A p p / , loader : 'vue-loader' , options : { loaders : { js : 'awesome-typescript-loader?silent=true' } } } ,
@@ -26,22 +21,18 @@ module.exports = (env) => {
2621 { test : / \. ( p n g | j p g | j p e g | g i f | s v g ) $ / , use : 'url-loader?limit=25000' }
2722 ]
2823 } ,
24+ output : {
25+ path : path . join ( __dirname , bundleOutputDir ) ,
26+ filename : '[name].js' ,
27+ publicPath : '/dist/'
28+ } ,
2929 plugins : [
3030 new CheckerPlugin ( ) ,
3131 new webpack . DefinePlugin ( {
3232 'process.env' : {
3333 NODE_ENV : JSON . stringify ( isDevBuild ? 'development' : 'production' )
3434 }
35- } )
36- ]
37- } ;
38-
39- // Configuration for client-side bundle suitable for running in browsers
40- const clientBundleOutputDir = './wwwroot/dist' ;
41- const clientBundleConfig = merge ( sharedConfig , {
42- entry : { 'main-client' : './ClientApp/boot-client.ts' } ,
43- output : { path : path . join ( __dirname , clientBundleOutputDir ) } ,
44- plugins : [
35+ } ) ,
4536 new webpack . DllReferencePlugin ( {
4637 context : __dirname ,
4738 manifest : require ( './wwwroot/dist/vendor-manifest.json' )
@@ -50,34 +41,11 @@ module.exports = (env) => {
5041 // Plugins that apply in development builds only
5142 new webpack . SourceMapDevToolPlugin ( {
5243 filename : '[file].map' , // Remove this line if you prefer inline source maps
53- moduleFilenameTemplate : path . relative ( clientBundleOutputDir , '[resourcePath]' ) // Point sourcemap entries to the original file locations on disk
44+ moduleFilenameTemplate : path . relative ( bundleOutputDir , '[resourcePath]' ) // Point sourcemap entries to the original file locations on disk
5445 } )
5546 ] : [
5647 // Plugins that apply in production builds only
5748 new webpack . optimize . UglifyJsPlugin ( )
5849 ] )
59- } ) ;
60-
61- // Configuration for server-side (prerendering) bundle suitable for running in Node
62- const serverBundlesOutput = {
63- libraryTarget : 'commonjs2' ,
64- path : path . join ( __dirname , './ClientApp/dist' )
65- } ;
66- const serverBundleConfig = merge ( sharedConfig , {
67- resolve : { mainFields : [ 'main' ] } ,
68- entry : { 'main' : './ClientApp/boot-server-bundle.ts' } ,
69- externals : { } ,
70- plugins : [ new VueSSRPlugin ( ) ] ,
71- output : serverBundlesOutput ,
72- target : 'node' ,
73- devtool : 'inline-source-map'
74- } ) ;
75-
76- const vueBundleRendererConfig = merge ( sharedConfig , {
77- entry : { 'main-server' : './ClientApp/boot-server.ts' } ,
78- output : serverBundlesOutput ,
79- target : 'node'
80- } ) ;
81-
82- return [ clientBundleConfig , serverBundleConfig , vueBundleRendererConfig ] ;
50+ } ] ;
8351} ;
0 commit comments