@@ -11,6 +11,8 @@ const configFileName = path.join(constants_1.ExtensionRootDir, 'tsconfig.extensi
11
11
// Some modules will be pre-genearted and stored in out/.. dir and they'll be referenced via NormalModuleReplacementPlugin
12
12
// We need to ensure they do not get bundled into the output (as they are large).
13
13
const existingModulesInOutDir = common_1 . getListOfExistingModulesInOutDir ( ) ;
14
+ // tslint:disable-next-line:no-var-requires no-require-imports
15
+ const FileManagerPlugin = require ( 'filemanager-webpack-plugin' ) ;
14
16
const config = {
15
17
mode : 'production' ,
16
18
target : 'node' ,
@@ -49,9 +51,9 @@ const config = {
49
51
}
50
52
]
51
53
} ,
52
- { enforce : 'post' , test : / u n i c o d e - p r o p e r t i e s [ \/ \\ ] i n d e x .j s $ / , loader : " transform-loader?brfs" } ,
53
- { enforce : 'post' , test : / f o n t k i t [ \/ \\ ] i n d e x .j s $ / , loader : " transform-loader?brfs" } ,
54
- { enforce : 'post' , test : / l i n e b r e a k [ \/ \\ ] s r c [ \/ \\ ] l i n e b r e a k e r .j s / , loader : " transform-loader?brfs" }
54
+ { enforce : 'post' , test : / u n i c o d e - p r o p e r t i e s [ \/ \\ ] i n d e x .j s $ / , loader : ' transform-loader?brfs' } ,
55
+ { enforce : 'post' , test : / f o n t k i t [ \/ \\ ] i n d e x .j s $ / , loader : ' transform-loader?brfs' } ,
56
+ { enforce : 'post' , test : / l i n e b r e a k [ \/ \\ ] s r c [ \/ \\ ] l i n e b r e a k e r .j s / , loader : ' transform-loader?brfs' }
55
57
]
56
58
} ,
57
59
externals : [
@@ -60,9 +62,26 @@ const config = {
60
62
...existingModulesInOutDir
61
63
] ,
62
64
plugins : [
63
- ...common_1 . getDefaultPlugins ( 'extension' )
65
+ ...common_1 . getDefaultPlugins ( 'extension' ) ,
66
+ // Copy pdfkit bits after extension builds. webpack can't handle pdfkit.
67
+ new FileManagerPlugin ( {
68
+ onEnd : [
69
+ {
70
+ copy : [
71
+ { source : './node_modules/pdfkit/js/data/*.*' , destination : './out/client/node_modules/data' } ,
72
+ { source : './node_modules/pdfkit/js/pdfkit.js' , destination : './out/client/node_modules/' }
73
+ ]
74
+ }
75
+ ]
76
+ } )
64
77
] ,
65
78
resolve : {
79
+ alias :{
80
+ // Pointing pdfkit to a dummy js file so webpack doesn't fall over.
81
+ // Since pdfkit has been externalized (it gets updated with the valid code by copying the pdfkit files
82
+ // into the right destination).
83
+ 'pdfkit' :path . resolve ( __dirname , 'pdfkit.js' )
84
+ } ,
66
85
extensions : [ '.ts' , '.js' ] ,
67
86
plugins : [
68
87
new tsconfig_paths_webpack_plugin_1 . TsconfigPathsPlugin ( { configFile : configFileName } )
0 commit comments