File tree 6 files changed +29
-5
lines changed
src/plugins/worker/workers
6 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ if (process.env['NODE_ENV'] === 'es5') {
70
70
[
71
71
'@babel/typescript' ,
72
72
{
73
+ loose : true ,
73
74
targets : {
74
75
edge : '17' ,
75
76
firefox : '60' ,
Original file line number Diff line number Diff line change @@ -819,7 +819,12 @@ https://www.npmjs.com/package/babel-plugin-transform-async-to-promises
819
819
820
820
BEFORE:
821
821
822
+ core:
822
823
Build-Size (minified+gzip):
823
824
75489
824
825
825
826
AFTER:
827
+
828
+ core:
829
+ Build-Size (minified+gzip):
830
+ 70723
Original file line number Diff line number Diff line change 168
168
"@typescript-eslint/parser" : " 4.33.0" ,
169
169
"assert" : " 2.0.0" ,
170
170
"async-test-util" : " 1.7.3" ,
171
+ "babel-loader" : " 8.2.3" ,
171
172
"babel-plugin-transform-class-properties" : " 6.24.1" ,
172
173
"brfs" : " 2.0.2" ,
173
174
"browserify" : " 17.0.0" ,
Original file line number Diff line number Diff line change 9
9
"moduleResolution" : " node" ,
10
10
"target" : " es2017" ,
11
11
"noEmit" : false ,
12
+
13
+ /**
14
+ * @link https://spblog.net/post/2018/10/26/TypeScript-Tips-How-to-reduce-the-size-of-a-bundle
15
+ */
16
+ "importHelpers" : true ,
17
+
12
18
"lib" : [
13
19
" es2017" ,
14
20
" webworker"
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const projectRootPath = path.resolve(
6
6
'../../../../'
7
7
) ;
8
8
9
+ const babelConfig = require ( '../../../../babel.config' ) ;
9
10
module . exports = {
10
11
entry : {
11
12
'lokijs-incremental-indexeddb' : './src/plugins/worker/workers/lokijs-incremental-indexeddb.worker.ts' ,
@@ -17,6 +18,7 @@ module.exports = {
17
18
} ,
18
19
output : {
19
20
filename : '[name].worker.js' ,
21
+ clean : true ,
20
22
path : path . resolve (
21
23
projectRootPath ,
22
24
'dist/workers'
@@ -34,15 +36,19 @@ module.exports = {
34
36
devtool : 'source-map' ,
35
37
module : {
36
38
rules : [
39
+ /**
40
+ * We transpile the typscript via babel instead of ts-loader.
41
+ * This ensures we have the exact same babel config
42
+ * as the root RxDB project.
43
+ */
37
44
{
38
45
test : / \. t s x ? $ / ,
46
+ exclude : / ( n o d e _ m o d u l e s ) / ,
39
47
use : {
40
- loader : 'ts-loader' ,
41
- options : {
42
- transpileOnly : true
43
- }
48
+ loader : 'babel-loader' ,
49
+ options : babelConfig
44
50
}
45
- } ,
51
+ }
46
52
] ,
47
53
} ,
48
54
resolve : {
Original file line number Diff line number Diff line change 19
19
"noEmit" : true ,
20
20
"declaration" : true ,
21
21
22
+ /**
23
+ * @link https://spblog.net/post/2018/10/26/TypeScript-Tips-How-to-reduce-the-size-of-a-bundle
24
+ */
25
+ "importHelpers" : true ,
26
+
22
27
"typeRoots" : [
23
28
" ./src/types/modules"
24
29
]
You can’t perform that action at this time.
0 commit comments