Skip to content
Snippets Groups Projects
Unverified Commit 47c7b4b9 authored by Acid Chicken (硫酸鶏)'s avatar Acid Chicken (硫酸鶏) Committed by GitHub
Browse files

fix(#10609): remove isChromatic on real build (#10613)


* perf: remove isChromatic on real build

* revert: Revert #10475 in MkTime

This reverts commit 7d11cf8e.

* @rollup/plugin-replace as dependencies

* fix pnpm-lock,yaml

---------

Co-authored-by: default avatartamaina <tamaina@hotmail.co.jp>
parent 55c10d0d
No related branches found
No related tags found
No related merge requests found
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<Plugin>)?.name === 'replace') ?? -1;
if (~replacePluginForIsChromatic) {
config.plugins?.splice(replacePluginForIsChromatic, 1);
}
return mergeConfig(config, {
plugins: [
turbosnap({
......
......@@ -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",
......
......@@ -8,6 +8,7 @@
</template>
<script lang="ts" setup>
import isChromatic from 'chromatic/isChromatic';
import { onUnmounted } from 'vue';
import { i18n } from '@/i18n';
import { dateTimeFormat } from '@/scripts/intl-const';
......@@ -17,7 +18,7 @@ const props = withDefaults(defineProps<{
origin?: Date | null;
mode?: 'relative' | 'absolute' | 'detail';
}>(), {
origin: null,
origin: isChromatic() ? new Date('2023-04-01T00:00:00Z') : null,
mode: 'relative',
});
......
import path from 'path';
import pluginReplace from '@rollup/plugin-replace';
import pluginVue from '@vitejs/plugin-vue';
import { type UserConfig, defineConfig } from 'vite';
......@@ -46,6 +47,16 @@ export function getConfig(): UserConfig {
reactivityTransform: true,
}),
pluginJson5(),
...process.env.NODE_ENV === 'production'
? [
pluginReplace({
preventAssignment: true,
values: {
'isChromatic()': JSON.stringify(false),
},
}),
]
: [],
],
resolve: {
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment