@@ -2,48 +2,46 @@ const path = require('path');
2
2
const webpack = require ( 'webpack' ) ;
3
3
const TerserPlugin = require ( 'terser-webpack-plugin' ) ;
4
4
const getPackageJson = require ( './scripts/getPackageJson' ) ;
5
- const MiniCssExtractPlugin = require ( " mini-css-extract-plugin" ) ;
6
- const CssMinimizerPlugin = require ( " css-minimizer-webpack-plugin" ) ;
5
+ const MiniCssExtractPlugin = require ( ' mini-css-extract-plugin' ) ;
6
+ const CssMinimizerPlugin = require ( ' css-minimizer-webpack-plugin' ) ;
7
7
const MergeIntoSingleFilePlugin = require ( 'webpack-merge-and-include-globally' ) ;
8
8
9
- const {
10
- version,
11
- name,
12
- license,
13
- repository,
14
- author,
15
- } = getPackageJson ( 'version' , 'name' , 'license' , 'repository' , 'author' ) ;
9
+ const { version , name , license , repository , author } = getPackageJson (
10
+ ' version' ,
11
+ ' name' ,
12
+ ' license' ,
13
+ ' repository' ,
14
+ ' author'
15
+ ) ;
16
16
17
17
const banner = `
18
18
${ name } v${ version }
19
19
${ repository . url }
20
20
21
- Copyright (c) ${ author . replace ( / * < [ ^ ) ] * > * / g, " " ) } and project contributors.
21
+ Copyright (c) ${ author . replace ( / * < [ ^ ) ] * > * / g, ' ' ) } and project contributors.
22
22
23
23
This source code is licensed under the ${ license } license found in the
24
24
LICENSE file in the root directory of this source tree.
25
25
` ;
26
26
27
27
module . exports = {
28
- mode : " production" ,
28
+ mode : ' production' ,
29
29
devtool : 'source-map' ,
30
30
entry : './src/index.tsx' ,
31
31
output : {
32
32
filename : 'index.js' ,
33
33
path : path . resolve ( __dirname , 'build' ) ,
34
- library : " ScatterGraph" ,
34
+ library : ' ScatterGraph' ,
35
35
libraryTarget : 'umd' ,
36
- clean : true
36
+ clean : true ,
37
+ globalObject : 'this'
37
38
} ,
38
39
externals : {
39
- ' react' : 'react'
40
+ react : 'react'
40
41
} ,
41
42
optimization : {
42
43
minimize : true ,
43
- minimizer : [
44
- new TerserPlugin ( { extractComments : false } ) ,
45
- new CssMinimizerPlugin ( )
46
- ] ,
44
+ minimizer : [ new TerserPlugin ( { extractComments : false } ) , new CssMinimizerPlugin ( ) ]
47
45
} ,
48
46
module : {
49
47
rules : [
@@ -53,7 +51,7 @@ module.exports = {
53
51
use : {
54
52
loader : 'babel-loader' ,
55
53
options : {
56
- presets : [ '@babel/preset-env' , '@babel/preset-react' ] ,
54
+ presets : [ '@babel/preset-env' , '@babel/preset-react' ]
57
55
}
58
56
}
59
57
} ,
@@ -73,18 +71,16 @@ module.exports = {
73
71
} ,
74
72
plugins : [
75
73
new MiniCssExtractPlugin ( {
76
- filename : 'css/index.css'
74
+ filename : 'css/index.css'
77
75
} ) ,
78
76
new webpack . BannerPlugin ( banner ) ,
79
77
new MergeIntoSingleFilePlugin ( {
80
78
files : {
81
- 'types/index.d.ts' : [
82
- path . resolve ( __dirname , 'src/types/types.d.ts' )
83
- ]
79
+ 'types/index.d.ts' : [ path . resolve ( __dirname , 'src/types/types.d.ts' ) ]
84
80
}
85
81
} )
86
82
] ,
87
83
resolve : {
88
- extensions : [ '.ts' , '.js' , '.tsx' , '.json' , " .css" , " .scss" ]
84
+ extensions : [ '.ts' , '.js' , '.tsx' , '.json' , ' .css' , ' .scss' ]
89
85
}
90
- } ;
86
+ } ;
0 commit comments