Skip to content

Commit 1312aaf

Browse files
committed
Add caching to the build
1 parent 34ac6cc commit 1312aaf

File tree

5 files changed

+29
-1
lines changed

5 files changed

+29
-1
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
key: v17-prod-app-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
6666
paths:
6767
- ./packages/app/www
68+
- ./packages/app/.cache-loader
6869
- save_cache:
6970
key: v17-prod-build-cache-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
7071
paths:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ lerna-debug.log
2828
standalone-packages/monaco-editor-core
2929

3030
.next
31+
.cache-loader

packages/app/config/webpack.common.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ const babelConfig = __DEV__ ? babelDev : babelProd;
2222

2323
const publicPath = SANDBOX_ONLY || __DEV__ ? '/' : getHost.default() + '/';
2424

25+
let threads = 1;
26+
27+
try {
28+
threads = Math.max(1, require('os').cpus().length - 1);
29+
} catch (e) {
30+
threads = 3;
31+
}
32+
2533
// Shim for `eslint-plugin-vue/lib/index.js`
2634
const ESLINT_PLUGIN_VUE_INDEX = `module.exports = {
2735
rules: {${fs
@@ -334,12 +342,13 @@ module.exports = {
334342
plugins: [
335343
new HappyPack({
336344
loaders: [
345+
'cache-loader',
337346
{
338347
path: 'babel-loader',
339348
query: babelConfig,
340349
},
341350
],
342-
threads: Math.max(1, require('os').cpus().length - 1),
351+
threads,
343352
}),
344353
...(SANDBOX_ONLY
345354
? [

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"babel-preset-env": "^1.6.0",
6868
"babel-preset-react": "^6.24.1",
6969
"buffer-loader": "^0.0.1",
70+
"cache-loader": "^2.0.1",
7071
"case-sensitive-paths-webpack-plugin": "^2.0.0",
7172
"chalk": "1.1.3",
7273
"connect-history-api-fallback": "1.3.0",

yarn.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6140,6 +6140,17 @@ cache-base@^1.0.1:
61406140
union-value "^1.0.0"
61416141
unset-value "^1.0.0"
61426142

6143+
cache-loader@^2.0.1:
6144+
version "2.0.1"
6145+
resolved "https://registry.yarnpkg.com/cache-loader/-/cache-loader-2.0.1.tgz#5758f41a62d7c23941e3c3c7016e6faeb03acb07"
6146+
integrity sha512-V99T3FOynmGx26Zom+JrVBytLBsmUCzVG2/4NnUKgvXN4bEV42R1ERl1IyiH/cvFIDA1Ytq2lPZ9tXDSahcQpQ==
6147+
dependencies:
6148+
loader-utils "^1.1.0"
6149+
mkdirp "^0.5.1"
6150+
neo-async "^2.6.0"
6151+
normalize-path "^3.0.0"
6152+
schema-utils "^1.0.0"
6153+
61436154
cache-manager-fs-hash@^0.0.6:
61446155
version "0.0.6"
61456156
resolved "https://registry.yarnpkg.com/cache-manager-fs-hash/-/cache-manager-fs-hash-0.0.6.tgz#fccc5a6b579080cbe2186697e51b5b8ff8ca9fd0"
@@ -16920,6 +16931,11 @@ neo-async@^2.5.0:
1692016931
version "2.5.1"
1692116932
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.5.1.tgz#acb909e327b1e87ec9ef15f41b8a269512ad41ee"
1692216933

16934+
neo-async@^2.6.0:
16935+
version "2.6.0"
16936+
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.0.tgz#b9d15e4d71c6762908654b5183ed38b753340835"
16937+
integrity sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==
16938+
1692316939
nerf-dart@^1.0.0:
1692416940
version "1.0.0"
1692516941
resolved "https://registry.yarnpkg.com/nerf-dart/-/nerf-dart-1.0.0.tgz#e6dab7febf5ad816ea81cf5c629c5a0ebde72c1a"

0 commit comments

Comments
 (0)