@@ -16,105 +16,105 @@ const lpackCfg = lPack.getConfig(),
1616 isExcluded = lPack . isFileExcluded ( ) ;
1717
1818module . exports = [
19- {
20- mode : lpackCfg . vars . production ? "production" : "development" ,
21- entry : {
22- App : [
23- lpackCfg . vars . rootAlias + '/index.server'
24- ] // default to 'App'
25- } ,
26- target : 'async-node' ,
27- output : {
28- path : lPack . getHeadRoot ( ) + "/" + ( lpackCfg . vars . targetDir || 'dist' ) ,
29- filename : "[name].server.js" ,
30- publicPath : "/" ,
31- libraryTarget : "commonjs2"
32- } ,
33- devtool : 'source-map' ,
34-
35- resolve : {
36- symlinks : false ,
37- extensions : [
38- "." ,
39- ".api.js" ,
40- ".api.jsx" ,
41- ".js" ,
42- ".jsx" ,
43- ".json" ,
44- ".scss" ,
45- ".css" ,
46- ] ,
47- } ,
48-
49- module : {
50- rules : [
51- {
52- test : / \. j s x ? $ / ,
53- exclude : isExcluded ,
54- use : [
55- {
56- loader : 'babel-loader' ,
57- options : {
58- cacheDirectory : true , //important for performance
59- presets : [
60- [ '@babel/preset-env' ,
61- {
62- ...( lpackCfg . vars . babelPreset || { } )
63- } ] ,
64- '@babel/preset-react'
65- ] ,
66- plugins : [
67- [ "@babel/plugin-proposal-decorators" , { "legacy" : true } ] ,
68- [ '@babel/plugin-transform-class-properties' , {
69- //"loose": true
70- } ] ,
71- [ "@babel/plugin-transform-runtime" , { } ] ,
72- ]
73- }
74- } ,
75- ]
76- } ,
77- {
78- test : / \. ( p n g | j p g | g i f | s v g | w o f f 2 | t t f | e o t ) ( \? .* $ | $ ) $ / ,
79- use : 'file-loader?limit=8192&name=assets/[hash].[ext]'
80- } ,
81- {
82- test : / \. w o f f 2 ? ( \? .* $ | $ ) $ / ,
83- use : "url-loader?prefix=font/&limit=5000&mimetype=application/font-woff&name=assets/[hash].[ext]"
84- } ,
85- { test : / \. h t m l $ / , use : "file-loader?name=[name].[ext]" } ,
86- { test : / \. t p l $ / , use : "dot-tpl-loader?append=true" } ,
87- {
88- test : / \. ( s c s s | c s s | l e s s ) ( \? .* $ | $ ) $ / ,
89- use : 'null-loader'
90- } ,
91-
92- { test : / \. o t f ( \? .* $ | $ ) $ / , use : "file-loader?name=assets/[hash].[ext]" } ,
93- {
94- test : / \. j s o n ? $ / ,
95- use : 'strip-json-comments-loader'
96- }
97- ] ,
98- } ,
99- plugins :
100- [
101- lPack . plugin ( ) ,
102-
103- //new HardSourceWebpackPlugin(),
104- ...( fs . existsSync ( "./LICENCE.HEAD.MD" ) && [
105- new webpack . BannerPlugin ( fs . readFileSync ( "./LICENCE.HEAD.MD" ) . toString ( ) )
106- ] || [ ]
107- ) ,
108-
109- ...( lpackCfg . vars . production && [
110- new BundleAnalyzerPlugin ( {
111- analyzerMode : 'static' ,
112- reportFilename : './' + lpackCfg . vars . rootAlias + '.stats.html' ,
113- openAnalyzer : false ,
114- ...lpackCfg . vars . BundleAnalyzerPlugin
115- } )
116-
117- ] || [ ] )
118- ] ,
119- }
19+ {
20+ mode : lpackCfg . vars . production ? "production" : "development" ,
21+ entry : {
22+ App : [
23+ lpackCfg . vars . rootAlias + '/index.server'
24+ ] // default to 'App'
25+ } ,
26+ target : 'async-node' ,
27+ output : {
28+ path : lPack . getHeadRoot ( ) + "/" + ( lpackCfg . vars . targetDir || 'dist' ) ,
29+ filename : "[name].server.js" ,
30+ publicPath : "/" ,
31+ libraryTarget : "commonjs2"
32+ } ,
33+ devtool : 'source-map' ,
34+
35+ resolve : {
36+ symlinks : false ,
37+ extensions : [
38+ "." ,
39+ ".api.js" ,
40+ ".api.jsx" ,
41+ ".js" ,
42+ ".jsx" ,
43+ ".json" ,
44+ ".scss" ,
45+ ".css" ,
46+ ] ,
47+ } ,
48+
49+ module : {
50+ rules : [
51+ {
52+ test : / \. j s x ? $ / ,
53+ exclude : isExcluded ,
54+ use : [
55+ {
56+ loader : 'babel-loader' ,
57+ options : {
58+ cacheDirectory : true , //important for performance
59+ presets : [
60+ [ '@babel/preset-env' ,
61+ {
62+ ...( lpackCfg . vars . babelPreset || { } )
63+ } ] ,
64+ '@babel/preset-react'
65+ ] ,
66+ plugins : [
67+ [ "@babel/plugin-proposal-decorators" , { "legacy" : true } ] ,
68+ [ '@babel/plugin-transform-class-properties' , {
69+ //"loose": true
70+ } ] ,
71+ [ "@babel/plugin-transform-runtime" , { } ] ,
72+ ]
73+ }
74+ } ,
75+ ]
76+ } ,
77+ {
78+ test : / \. ( p n g | j p g | g i f | s v g | w o f f 2 | t t f | e o t ) ( \? .* $ | $ ) $ / ,
79+ use : 'file-loader?limit=8192&name=assets/[hash].[ext]'
80+ } ,
81+ {
82+ test : / \. w o f f 2 ? ( \? .* $ | $ ) $ / ,
83+ use : "url-loader?prefix=font/&limit=5000&mimetype=application/font-woff&name=assets/[hash].[ext]"
84+ } ,
85+ { test : / \. h t m l $ / , use : "file-loader?name=[name].[ext]" } ,
86+ { test : / \. t p l $ / , use : "dot-tpl-loader?append=true" } ,
87+ {
88+ test : / \. ( s c s s | c s s | l e s s ) ( \? .* $ | $ ) $ / ,
89+ use : 'null-loader'
90+ } ,
91+
92+ { test : / \. o t f ( \? .* $ | $ ) $ / , use : "file-loader?name=assets/[hash].[ext]" } ,
93+ {
94+ test : / \. j s o n ? $ / ,
95+ use : 'strip-json-comments-loader'
96+ }
97+ ] ,
98+ } ,
99+ plugins :
100+ [
101+ lPack . plugin ( ) ,
102+
103+ //new HardSourceWebpackPlugin(),
104+ ...( fs . existsSync ( "./LICENCE.HEAD.MD" ) && [
105+ new webpack . BannerPlugin ( fs . readFileSync ( "./LICENCE.HEAD.MD" ) . toString ( ) )
106+ ] || [ ]
107+ ) ,
108+
109+ ...( lpackCfg . vars . production && [
110+ new BundleAnalyzerPlugin ( {
111+ analyzerMode : 'static' ,
112+ reportFilename : './' + lpackCfg . vars . rootAlias + '.stats.html' ,
113+ openAnalyzer : false ,
114+ ...lpackCfg . vars . BundleAnalyzerPlugin
115+ } )
116+
117+ ] || [ ] )
118+ ] ,
119+ }
120120]
0 commit comments