diff --git a/.gitignore b/.gitignore index dda137f98b2..74f30b346b4 100755 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ common-dist/ packages/cbioportal-frontend-commons/dist .sass-cache .rpt2_cache +.webpack-cache/ frontend-cbioportal.iml test/ .classpath diff --git a/tsconfig.json b/tsconfig.json index ff9f396f387..d998082e089 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,7 +21,9 @@ "typeRoots": [ "node_modules/@types" ], - "lib":["es2015", "es2016.array.include", "dom"] + "lib":["es2015", "es2016.array.include", "dom"], + "incremental": true, + "tsBuildInfoFile": "./tsDist/.tsbuildinfo" }, "exclude": ["./node_modules/*"], "include": [ diff --git a/webpack.config.js b/webpack.config.js index 60e2697c3a2..2a0496d0b0e 100755 --- a/webpack.config.js +++ b/webpack.config.js @@ -102,10 +102,19 @@ var config = { publicPath: '/', }, + // Enable webpack persistent caching for faster rebuilds + cache: { + type: 'filesystem', + cacheDirectory: path.resolve(__dirname, '.webpack-cache'), + buildDependencies: { + config: [__filename], + }, + }, + optimization: { minimizer: [ new TerserPlugin({ - parallel: false, + parallel: true, }), ], }, @@ -212,8 +221,7 @@ var config = { { loader: 'ts-loader', options: { - transpileOnly: - isDev || isTest || process.env.NETLIFY, + transpileOnly: true, }, }, ], @@ -469,8 +477,6 @@ if (isDev || isTest) { 'shared/Empty.tsx' ); - config.plugins.push(new ForkTsCheckerWebpackPlugin()); - // css modules for any scss matching test config.module.rules.push({ test: /\.module\.scss$/, @@ -564,6 +570,9 @@ if (isDev || isTest) { }); } +// Add ForkTsCheckerWebpackPlugin for all builds since we use transpileOnly +config.plugins.push(new ForkTsCheckerWebpackPlugin()); + // reduce logging to optimize netlify build if (process.env.BUILD_REPORT_ERRORS_ONLY === 'true') { config.stats = 'errors-only';