From 20bbda794ec5fa2a263b62b67ed6c4ea319290ee Mon Sep 17 00:00:00 2001 From: undefined Date: Sun, 7 Aug 2022 04:03:02 +0800 Subject: [PATCH] ui: ensure build cache --- .github/workflows/build.yml | 5 ++--- packages/ui-default/build/config/webpack.ts | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50a012b3..e240ed17 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,10 +35,9 @@ jobs: yarn.lock .cache **/tsconfig.tsbuildinfo - key: ${{ github.ref }} + key: cache-${{ github.ref }} restore-keys: | - master - main + cache- - name: Config And Install run: | [[ ! -z "${{secrets.NPM_TOKEN}}" ]] && echo "npmAuthToken: ${{secrets.NPM_TOKEN}}" >> .yarnrc.yml diff --git a/packages/ui-default/build/config/webpack.ts b/packages/ui-default/build/config/webpack.ts index 7a96f814..4cfa5326 100644 --- a/packages/ui-default/build/config/webpack.ts +++ b/packages/ui-default/build/config/webpack.ts @@ -82,6 +82,9 @@ export default function (env: { production?: boolean, measure?: boolean } = {}) type: 'filesystem', cacheDirectory: root('../../.cache'), idleTimeout: 30000, + buildDependencies: { + config: [__filename], + }, }, output: { path: root('public'), @@ -236,6 +239,9 @@ export default function (env: { production?: boolean, measure?: boolean } = {}) new webpack.DefinePlugin({ 'process.env.VERSION': JSON.stringify(require('@hydrooj/ui-default/package.json').version), }), + new webpack.optimize.MinChunkSizePlugin({ + minChunkSize: 128000, + }), new webpack.NormalModuleReplacementPlugin(/\/(vscode-)?nls\.js/, require.resolve('../../components/monaco/nls')), new MonacoWebpackPlugin({ filename: '[name].[hash:10].worker.js',