Skip to content

Commit

Permalink
fix(core): storybook build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pengx17 committed Mar 23, 2024
1 parent 34703a3 commit 96d2eef
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 16 deletions.
3 changes: 3 additions & 0 deletions packages/frontend/component/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export default {
async viteFinal(config, _options) {
return mergeConfig(config, {
plugins: [vanillaExtractPlugin()],
esbuild: {
target: 'ES2022',
},
define: {
'process.env': {},
'process.env.COVERAGE': JSON.stringify(!!process.env.COVERAGE),
Expand Down
2 changes: 2 additions & 0 deletions packages/frontend/component/.storybook/polyfill.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import 'core-js/modules/esnext.symbol.async-dispose';
import 'core-js/modules/esnext.symbol.dispose';
1 change: 1 addition & 0 deletions packages/frontend/component/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './polyfill';
import '../src/theme/global.css';
import './preview.css';
import { ThemeProvider, useTheme } from 'next-themes';
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"devDependencies": {
"@blocksuite/blocks": "0.13.0-canary-202403140735-2367cd5",
"@blocksuite/global": "0.13.0-canary-202403140735-2367cd5",
"@blocksuite/icons": "2.1.45",
"@blocksuite/icons": "2.1.46",
"@blocksuite/lit": "0.13.0-canary-202403140735-2367cd5",
"@blocksuite/presets": "0.13.0-canary-202403140735-2367cd5",
"@blocksuite/store": "0.13.0-canary-202403140735-2367cd5",
Expand Down
7 changes: 5 additions & 2 deletions tests/storybook/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { runCli } from '@magic-works/i18n-codegen';
import type { StorybookConfig } from '@storybook/react-vite';
import { fileURLToPath } from 'node:url';
import { mergeConfig } from 'vite';
import { mergeConfig, type InlineConfig } from 'vite';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
import { getRuntimeConfig } from '@affine/cli/src/webpack/runtime-config';

Expand Down Expand Up @@ -40,7 +40,7 @@ export default {
});
// disable for storybook build
runtimeConfig.enableCloud = false;
return mergeConfig(config, {
return mergeConfig<InlineConfig, InlineConfig>(config, {
assetsInclude: ['**/*.md'],
resolve: {
alias: {
Expand All @@ -51,6 +51,9 @@ export default {
),
},
},
esbuild: {
target: 'ES2022',
},
plugins: [vanillaExtractPlugin()],
define: {
'process.on': 'undefined',
Expand Down
2 changes: 2 additions & 0 deletions tests/storybook/.storybook/polyfill.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import 'core-js/modules/esnext.symbol.async-dispose';
import 'core-js/modules/esnext.symbol.dispose';
1 change: 1 addition & 0 deletions tests/storybook/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './polyfill';
import '@affine/component/theme/global.css';
import '@affine/component/theme/theme.css';
import { createI18n } from '@affine/i18n';
Expand Down
2 changes: 1 addition & 1 deletion tests/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@blocksuite/block-std": "0.13.0-canary-202403140735-2367cd5",
"@blocksuite/blocks": "0.13.0-canary-202403140735-2367cd5",
"@blocksuite/global": "0.13.0-canary-202403140735-2367cd5",
"@blocksuite/icons": "2.1.45",
"@blocksuite/icons": "2.1.46",
"@blocksuite/inline": "0.13.0-canary-202403140735-2367cd5",
"@blocksuite/lit": "0.13.0-canary-202403140735-2367cd5",
"@blocksuite/presets": "0.13.0-canary-202403140735-2367cd5",
Expand Down
14 changes: 2 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ __metadata:
"@affine/i18n": "workspace:*"
"@blocksuite/blocks": "npm:0.13.0-canary-202403140735-2367cd5"
"@blocksuite/global": "npm:0.13.0-canary-202403140735-2367cd5"
"@blocksuite/icons": "npm:2.1.45"
"@blocksuite/icons": "npm:2.1.46"
"@blocksuite/lit": "npm:0.13.0-canary-202403140735-2367cd5"
"@blocksuite/presets": "npm:0.13.0-canary-202403140735-2367cd5"
"@blocksuite/store": "npm:0.13.0-canary-202403140735-2367cd5"
Expand Down Expand Up @@ -762,7 +762,7 @@ __metadata:
"@blocksuite/block-std": "npm:0.13.0-canary-202403140735-2367cd5"
"@blocksuite/blocks": "npm:0.13.0-canary-202403140735-2367cd5"
"@blocksuite/global": "npm:0.13.0-canary-202403140735-2367cd5"
"@blocksuite/icons": "npm:2.1.45"
"@blocksuite/icons": "npm:2.1.46"
"@blocksuite/inline": "npm:0.13.0-canary-202403140735-2367cd5"
"@blocksuite/lit": "npm:0.13.0-canary-202403140735-2367cd5"
"@blocksuite/presets": "npm:0.13.0-canary-202403140735-2367cd5"
Expand Down Expand Up @@ -3530,16 +3530,6 @@ __metadata:
languageName: node
linkType: hard

"@blocksuite/icons@npm:2.1.45":
version: 2.1.45
resolution: "@blocksuite/icons@npm:2.1.45"
peerDependencies:
"@types/react": ^18.0.25
react: ^18.2.0
checksum: 10/a77b46ab6f2325005fb873f5d1e5982bcf01588fa1c03cebaf6f4c4a1cb380dfc39c60334ceb4a7fca9486cb9e4911c15f79e54da45ed87bcea6425b00cb20e5
languageName: node
linkType: hard

"@blocksuite/icons@npm:2.1.46":
version: 2.1.46
resolution: "@blocksuite/icons@npm:2.1.46"
Expand Down

0 comments on commit 96d2eef

Please sign in to comment.