1
1
// node modules
2
+ const path = require ( 'path' ) ;
2
3
const { merge } = require ( 'webpack-merge' ) ;
3
- const moment = require ( 'moment' ) ;
4
4
const webpack = require ( 'webpack' ) ;
5
- const TerserPlugin = require ( "terser-webpack-plugin" ) ;
5
+ const fs = require ( 'fs' ) ;
6
+ const TerserPlugin = require ( 'terser-webpack-plugin' ) ;
6
7
7
8
// webpack plugins
8
- const BundleAnalyzerPlugin = require ( 'webpack-bundle-analyzer' )
9
- . BundleAnalyzerPlugin ;
9
+ const BundleAnalyzerPlugin =
10
+ require ( 'webpack-bundle-analyzer' ) . BundleAnalyzerPlugin ;
10
11
11
12
// config files
12
13
const common = require ( './webpack.common.js' ) ;
13
14
const settings = require ( './webpack.settings.js' ) ;
14
15
15
- // Configure file banner
16
- function configureBanner ( ) {
17
- return {
18
- banner : [
19
- '/*!' ,
20
- ` * @project ${ settings . name } ` ,
21
- ` * @build ${ moment ( ) . format ( 'llll' ) } ET` ,
22
- ` * @copyright Copyright (c) ${ moment ( ) . format ( 'YYYY' ) } ${
23
- settings . copyright
24
- } `,
25
- ' *' ,
26
- ' */' ,
27
- '' ,
28
- ] . join ( '\n' ) ,
29
- raw : true ,
30
- } ;
31
- }
32
-
33
16
// Configure Bundle Analyzer
34
17
function configureBundleAnalyzer ( name ) {
35
18
return {
@@ -51,6 +34,7 @@ function configureOptimization() {
51
34
/ S o u r c e s \/ / ,
52
35
/ U t i l i t i e s \/ / ,
53
36
] ,
37
+ extractComments : false ,
54
38
} ) ,
55
39
] ,
56
40
} ;
@@ -63,8 +47,10 @@ module.exports = [
63
47
devtool : 'source-map' ,
64
48
optimization : configureOptimization ( ) ,
65
49
plugins : [
50
+ new webpack . BannerPlugin (
51
+ `/* ${ fs . readFileSync ( path . resolve ( __dirname , './LICENSE' ) , 'utf8' ) } */`
52
+ ) ,
66
53
new webpack . optimize . ModuleConcatenationPlugin ( ) ,
67
- new webpack . BannerPlugin ( configureBanner ( ) ) ,
68
54
new BundleAnalyzerPlugin ( configureBundleAnalyzer ( 'vtk' ) ) ,
69
55
] ,
70
56
} ) ,
@@ -73,8 +59,10 @@ module.exports = [
73
59
devtool : 'source-map' ,
74
60
optimization : configureOptimization ( ) ,
75
61
plugins : [
62
+ new webpack . BannerPlugin (
63
+ `/* ${ fs . readFileSync ( path . resolve ( __dirname , './LICENSE' ) , 'utf8' ) } */`
64
+ ) ,
76
65
new webpack . optimize . ModuleConcatenationPlugin ( ) ,
77
- new webpack . BannerPlugin ( configureBanner ( ) ) ,
78
66
new BundleAnalyzerPlugin ( configureBundleAnalyzer ( 'vtk-lite' ) ) ,
79
67
] ,
80
68
} ) ,
0 commit comments