From 3f7947c2034bf749520f9f5c43aaa69c09638d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Acid=20Chicken=20=28=E7=A1=AB=E9=85=B8=E9=B6=8F=29?= Date: Thu, 13 Apr 2023 23:23:11 +0900 Subject: [PATCH] fix(#10609): remove isChromatic on real build (#10613) * perf: remove isChromatic on real build * revert: Revert #10475 in MkTime This reverts commit 7d11cf8ec9ebe2866aca345a709fb226346b2dde. * @rollup/plugin-replace as dependencies * fix pnpm-lock,yaml --------- Co-authored-by: tamaina --- packages/frontend/.storybook/main.ts | 6 +- packages/frontend/package.json | 3 +- .../frontend/src/components/global/MkTime.vue | 3 +- packages/frontend/vite.config.ts | 11 + pnpm-lock.yaml | 227 ++++++++++++------ 5 files changed, 178 insertions(+), 72 deletions(-) diff --git a/packages/frontend/.storybook/main.ts b/packages/frontend/.storybook/main.ts index 45db48fa1da6..1d0ce5ab63c9 100644 --- a/packages/frontend/.storybook/main.ts +++ b/packages/frontend/.storybook/main.ts @@ -1,6 +1,6 @@ import { resolve } from 'node:path'; import type { StorybookConfig } from '@storybook/vue3-vite'; -import { mergeConfig } from 'vite'; +import { type Plugin, mergeConfig } from 'vite'; import turbosnap from 'vite-plugin-turbosnap'; const config = { stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], @@ -22,6 +22,10 @@ const config = { disableTelemetry: true, }, async viteFinal(config) { + const replacePluginForIsChromatic = config.plugins?.findIndex((plugin) => plugin && (plugin as Partial)?.name === 'replace') ?? -1; + if (~replacePluginForIsChromatic) { + config.plugins?.splice(replacePluginForIsChromatic, 1); + } return mergeConfig(config, { plugins: [ turbosnap({ diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 05157c6013a6..b3e9ff2db13b 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -17,6 +17,7 @@ "@discordapp/twemoji": "14.1.2", "@rollup/plugin-alias": "4.0.3", "@rollup/plugin-json": "6.0.0", + "@rollup/plugin-replace": "^5.0.2", "@rollup/pluginutils": "5.0.2", "@syuilo/aiscript": "0.13.1", "@tabler/icons-webfont": "2.12.0", @@ -32,6 +33,7 @@ "chartjs-chart-matrix": "2.0.1", "chartjs-plugin-gradient": "0.6.1", "chartjs-plugin-zoom": "2.0.1", + "chromatic": "6.17.3", "compare-versions": "5.0.1", "cropperjs": "2.0.0-beta.2", "date-fns": "2.29.3", @@ -116,7 +118,6 @@ "@vue/runtime-core": "3.2.47", "astring": "1.8.4", "chokidar-cli": "3.0.0", - "chromatic": "6.17.3", "cross-env": "7.0.3", "cypress": "12.9.0", "eslint": "8.37.0", diff --git a/packages/frontend/src/components/global/MkTime.vue b/packages/frontend/src/components/global/MkTime.vue index 99169512dbd7..261cc0ee18ca 100644 --- a/packages/frontend/src/components/global/MkTime.vue +++ b/packages/frontend/src/components/global/MkTime.vue @@ -8,6 +8,7 @@