feat: use webpack caching in development (#42286)

* feat: use webpack caching in development

This cuts build time for build-workers considerably.

* fix: update gitpod config

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
Oliver Eyton-Williams
2021-05-30 09:59:55 +02:00
committed by GitHub
parent e605800d82
commit 90d2c3b344
3 changed files with 5 additions and 6 deletions

View File

@ -51,8 +51,7 @@ tasks:
init: >
cd ./client &&
gp sync-await npm-ci &&
npm run prebuild &&
npm run build:workers &&
npm run predevelop &&
cd ..
command: >
gp await-port 3000 &&

View File

@ -19,12 +19,11 @@
"author": "freeCodeCamp <team@freecodecamp.org>",
"main": "none",
"scripts": {
"prebuild": "echo 'Client workers building...' && npm run build:workers && echo 'Client workers ready.' && node ../tools/scripts/build/ensure-env.js",
"prebuild": "node ../tools/scripts/build/ensure-env.js && npm run build:workers -- --env production",
"build": "node --max_old_space_size=7168 node_modules/gatsby-cli build --prefix-paths",
"build:workers": "node --max_old_space_size=7168 node_modules/webpack-cli/bin/cli --env production --config ./webpack-workers.js && echo",
"build:workers:debug": "node --max_old_space_size=7168 node_modules/webpack-cli/bin/cli --env production --config ./webpack-workers.js --progress",
"build:workers": "node --max_old_space_size=7168 node_modules/webpack-cli/bin/cli --config ./webpack-workers.js",
"clean": "gatsby clean",
"predevelop": "npm run prebuild",
"predevelop": "node ../tools/scripts/build/ensure-env.js && npm run build:workers -- --env development",
"develop": "gatsby develop --inspect=9230",
"format": "npm run format:gatsby && npm run format:src && npm run format:utils",
"format:gatsby": "prettier-eslint --write --trailing-comma none --single-quote './gatsby-*.js'",

View File

@ -8,6 +8,7 @@ module.exports = (env = {}) => {
const staticPath = path.join(__dirname, './static/js');
const configPath = path.join(__dirname, '../config/client');
return {
cache: __DEV__ ? { type: 'filesystem' } : false,
mode: __DEV__ ? 'development' : 'production',
entry: {
'frame-runner': './src/client/frame-runner.js',