This repository was archived by the owner on Jul 6, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ scripts/*
4
4
sandbox.ts
5
5
test_utils /*
6
6
examples /*
7
+ webpack. *
Original file line number Diff line number Diff line change 10
10
" lib/**/*"
11
11
],
12
12
"main" : " lib/index.js" ,
13
+ "browser" : " lib/index.browser.js" ,
13
14
"types" : " lib/index.d.ts" ,
14
15
"scripts" : {
15
16
"start" : " webpack-dev-server --config=webpack.config.dev.js" ,
Original file line number Diff line number Diff line change @@ -3,17 +3,34 @@ const merge = require('webpack-merge');
3
3
4
4
const baseConfig = require ( './webpack.base' ) ;
5
5
6
- const buildConfig = merge . smart ( baseConfig , {
6
+ const browserConfig = merge . smart ( baseConfig , {
7
7
devtool : 'source-map' ,
8
8
mode : 'production' ,
9
9
entry : path . resolve ( __dirname , './src/index.ts' ) ,
10
+ target : 'web' ,
11
+ output : {
12
+ pathinfo : true ,
13
+ filename : 'index.browser.js' ,
14
+ path : path . resolve ( __dirname , 'lib' ) ,
15
+ library : '@polymathnetwork/contract-wrappers' ,
16
+ libraryTarget : 'commonjs2' ,
17
+ globalObject : 'this' ,
18
+ }
19
+ } )
20
+
21
+ const nodeConfig = merge . smart ( baseConfig , {
22
+ devtool : 'source-map' ,
23
+ mode : 'production' ,
24
+ entry : path . resolve ( __dirname , './src/index.ts' ) ,
25
+ target : 'node' ,
10
26
output : {
11
27
pathinfo : true ,
12
28
filename : 'index.js' ,
13
29
path : path . resolve ( __dirname , 'lib' ) ,
14
30
library : '@polymathnetwork/contract-wrappers' ,
15
- libraryTarget : 'commonjs2'
31
+ libraryTarget : 'commonjs2' ,
32
+ globalObject : 'this' ,
16
33
}
17
34
} ) ;
18
35
19
- module . exports = buildConfig ;
36
+ module . exports = [ browserConfig , nodeConfig ] ;
You can’t perform that action at this time.
0 commit comments