@@ -4,10 +4,10 @@ const path = require("path");
44const VueLoaderPlugin = require ( "vue-loader/lib/plugin" ) ;
55const MiniCssExtractPlugin = require ( "mini-css-extract-plugin" ) ;
66const CssMinimizerPlugin = require ( "css-minimizer-webpack-plugin" ) ;
7- const DuplicatePackageCheckerPlugin = require ( "@cerner/duplicate-package-checker-webpack-plugin" ) ;
87const { DumpMetaPlugin } = require ( "dumpmeta-webpack-plugin" ) ;
98const TsconfigPathsPlugin = require ( "tsconfig-paths-webpack-plugin" ) ;
109const TerserPlugin = require ( "terser-webpack-plugin" ) ;
10+ const ForkTsCheckerWebpackPlugin = require ( "fork-ts-checker-webpack-plugin" ) ;
1111
1212const scriptsBase = path . join ( __dirname , "src" ) ;
1313const testsBase = path . join ( __dirname , "tests" ) ;
@@ -111,11 +111,21 @@ module.exports = (env = {}, argv = {}) => {
111111 {
112112 test : / \. t s x ? $ / ,
113113 exclude : / n o d e _ m o d u l e s / ,
114- loader : "ts-loader" ,
115- options : {
116- configFile : "tsconfig.webpack.json" ,
117- appendTsSuffixTo : [ / \. v u e $ / ] ,
118- } ,
114+ use : [
115+ {
116+ loader : "thread-loader" ,
117+ // options: { workers: 2 },
118+ } ,
119+ {
120+ loader : "ts-loader" ,
121+ options : {
122+ transpileOnly : true ,
123+ happyPackMode : true , // IMPORTANT! use happyPackMode mode to allow thread-loader
124+ configFile : "tsconfig.webpack.json" ,
125+ appendTsSuffixTo : [ / \. v u e $ / ] ,
126+ } ,
127+ } ,
128+ ] ,
119129 } ,
120130 {
121131 test : / \. m j s $ / ,
@@ -175,18 +185,16 @@ module.exports = (env = {}, argv = {}) => {
175185 } ,
176186 {
177187 loader : "css-loader" ,
178- options : { sourceMap : true } ,
179188 } ,
180189 {
181190 loader : "postcss-loader" ,
182191 } ,
183192 {
184193 loader : "sass-loader" ,
185194 options : {
186- sourceMap : true ,
187195 sassOptions : {
188196 quietDeps : true ,
189- includePaths : [
197+ loadPaths : [
190198 path . join ( styleBase , "scss" ) ,
191199 path . resolve ( __dirname , "./node_modules" ) ,
192200 ] ,
@@ -234,7 +242,6 @@ module.exports = (env = {}, argv = {}) => {
234242 new MiniCssExtractPlugin ( {
235243 filename : "[name].css" ,
236244 } ) ,
237- new DuplicatePackageCheckerPlugin ( ) ,
238245 new DumpMetaPlugin ( {
239246 filename : path . join ( __dirname , "../lib/galaxy/web/framework/meta.json" ) ,
240247 prepare : ( stats ) => ( {
@@ -243,7 +250,22 @@ module.exports = (env = {}, argv = {}) => {
243250 epoch : Date . parse ( buildDate ) ,
244251 } ) ,
245252 } ) ,
253+ new ForkTsCheckerWebpackPlugin ( {
254+ async : false ,
255+ typescript : {
256+ diagnosticOptions : {
257+ semantic : true ,
258+ syntactic : true ,
259+ } ,
260+ } ,
261+ } ) ,
246262 ] ,
263+ cache : {
264+ type : "filesystem" ,
265+ buildDependencies : {
266+ config : [ __filename ] ,
267+ } ,
268+ } ,
247269 devServer : {
248270 client : {
249271 overlay : {
@@ -265,8 +287,9 @@ module.exports = (env = {}, argv = {}) => {
265287 // proxy *everything* to the galaxy server.
266288 // someday, when we have a fully API-driven independent client, this
267289 // can be a more limited set -- e.g. `/api`, `/auth`
268- proxy : {
269- "**" : {
290+ proxy : [
291+ {
292+ context : [ "**" ] ,
270293 // We explicitly use ipv4 loopback instead of localhost to
271294 // avoid ipv6/ipv4 resolution order issues; this should
272295 // align with Galaxy's default.
@@ -275,12 +298,12 @@ module.exports = (env = {}, argv = {}) => {
275298 changeOrigin : ! ! process . env . CHANGE_ORIGIN ,
276299 logLevel : "debug" ,
277300 } ,
278- } ,
301+ ] ,
279302 } ,
280303 } ;
281304
282305 if ( process . env . GXY_BUILD_SOURCEMAPS ) {
283- buildconfig . devtool = "source-map" ;
306+ buildconfig . devtool = "eval-cheap-module- source-map" ;
284307 }
285308
286309 return buildconfig ;
0 commit comments