diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5c24e62bfca2..f1d83b9c9c42 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,6 +23,16 @@ jobs: node-version: ${{ matrix.node-version }} cache: yarn + - name: Enable webpack persistent caching + uses: actions/cache@v3 + id: build-webpack-persistent-cache + with: + path: node_modules/.cache + key: build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: |- + build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }} + build-${{ hashFiles('**/webpack.*.mjs') }}- + - run: yarn --frozen-lockfile - name: Build site run: yarn build diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 84fde7e4ad3e..eafe631f7dfe 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -58,6 +58,16 @@ jobs: - run: yarn + - name: Enable webpack persistent caching + uses: actions/cache@v3 + id: build-webpack-persistent-cache + with: + path: node_modules/.cache + key: build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: |- + build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }} + build-${{ hashFiles('**/webpack.*.mjs') }}- + - name: Build site run: yarn build env: @@ -74,6 +84,16 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Enable webpack persistent caching + uses: actions/cache@v3 + id: build-webpack-persistent-cache + with: + path: node_modules/.cache + key: build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: |- + build-${{ hashFiles('**/webpack.*.mjs') }}-${{ hashFiles('**/yarn.lock') }} + build-${{ hashFiles('**/webpack.*.mjs') }}- + - name: Cypress run uses: cypress-io/github-action@v4 with: diff --git a/package.json b/package.json index c8448aeeaca7..1e7923606d3b 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,8 @@ "cypress:open": "cypress open", "cypress:run": "cypress run", "prettier": "prettier --write '**/*.{js,json,jsx,css,scss,md,mdx}'", - "prepare": "husky install" + "prepare": "husky install", + "postinstall": "rimraf ./node_modules/.cache/webpack" }, "lint-staged": { "*.{js,jsx,md,mdx}": [ diff --git a/webpack.common.mjs b/webpack.common.mjs index 8dd46af61d30..a9cc9d2399bf 100644 --- a/webpack.common.mjs +++ b/webpack.common.mjs @@ -55,7 +55,7 @@ export default ({ ssg = false }) => ({ buildDependencies: { config: [__filename], }, - cacheDirectory: path.resolve(__dirname, '.cache/webpack'), + cacheDirectory: path.resolve(__dirname, 'node_modules/.cache/webpack') }, resolve: { extensions: ['.js', '.jsx', '.scss'], diff --git a/webpack.prod.mjs b/webpack.prod.mjs index 5c2103d8c1c3..70d260c75734 100644 --- a/webpack.prod.mjs +++ b/webpack.prod.mjs @@ -15,11 +15,6 @@ import ProdAssetsManifest from './src/ProdAssetsManifest.mjs'; export default (env) => merge(common(env), { mode: 'production', - cache: { - buildDependencies: { - config: [__filename], - }, - }, entry: { index: { import: './index.jsx', diff --git a/webpack.ssg.mjs b/webpack.ssg.mjs index 3d668a9fdd68..ec8fa8cc9ce2 100644 --- a/webpack.ssg.mjs +++ b/webpack.ssg.mjs @@ -24,11 +24,6 @@ export default (env) => name: 'ssg', mode: 'production', target: 'node', - cache: { - buildDependencies: { - config: [__filename], - }, - }, module: { parser: { javascript: {