@@ -9,11 +9,10 @@ const CopyPlugin = require('copy-webpack-plugin');
99
1010const daemonVersion = new webpack . DefinePlugin ( {
1111 'process.env.DAEMON_VERSION' : JSON . stringify ( packageJSON . daemonVersion ?? '0.0.1' ) ,
12- 'process.env.DAEMON_EXTENSION_VERSION' : JSON . stringify ( packageJSON . version ) ,
1312} ) ;
1413
1514/**@type {import('webpack').Configuration }*/
16- const config = {
15+ const prodConfig = {
1716 target : 'node' ,
1817 entry : {
1918 extension : './src/extension.ts' ,
@@ -61,4 +60,57 @@ const config = {
6160 ]
6261}
6362
64- module . exports = config ;
63+ /**@type {import('webpack').Configuration }*/
64+ const devConfig = {
65+ target : 'node' ,
66+ entry : {
67+ 'local-ssh/proxy' : './src/local-ssh/proxy.ts' ,
68+ } ,
69+ output : {
70+ path : path . resolve ( __dirname , 'out' ) ,
71+ filename : '[name].js' ,
72+ libraryTarget : "commonjs2" ,
73+ devtoolModuleFilenameTemplate : "../[resource-path]" ,
74+ } ,
75+ devtool : 'source-map' ,
76+ externals : {
77+ bufferutil : "bufferutil" ,
78+ "utf-8-validate" : "utf-8-validate" ,
79+ "node-rsa" : "node-rsa"
80+ } ,
81+ resolve : {
82+ extensions : [ '.ts' , '.js' ]
83+ } ,
84+ module : {
85+ rules : [ {
86+ test : / \. t s $ / ,
87+ exclude : / n o d e _ m o d u l e s / ,
88+ use : [ {
89+ loader : 'ts-loader'
90+ } ]
91+ } ]
92+ } ,
93+ plugins : [
94+ new CopyPlugin ( {
95+ patterns : [
96+ { from : 'src/local-ssh/proxylauncher.bat' , to : 'local-ssh/proxylauncher.bat' } ,
97+ { from : 'src/local-ssh/proxylauncher.sh' , to : 'local-ssh/proxylauncher.sh' } ,
98+ ] ,
99+ } ) ,
100+ daemonVersion ,
101+ ] ,
102+ watchOptions : {
103+ // for some systems, watching many files can result in a lot of CPU or memory usage
104+ // https://webpack.js.org/configuration/watch/#watchoptionsignored
105+ // don't use this pattern, if you have a monorepo with linked packages
106+ ignored : / n o d e _ m o d u l e s / ,
107+ } ,
108+ }
109+
110+ module . exports = ( _env , argv ) => {
111+ if ( argv . mode === 'development' ) {
112+ return devConfig ;
113+ }
114+
115+ return prodConfig ;
116+ } ;
0 commit comments