Skip to content

Commit 99fbec4

Browse files
committed
chore: @storybook/react-vite
1 parent 26e0a31 commit 99fbec4

File tree

5 files changed

+347
-1060
lines changed

5 files changed

+347
-1060
lines changed

.babelrc.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

.storybook/main.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
import type { StorybookConfig } from '@storybook/react-webpack5'
1+
import type { StorybookConfig } from '@storybook/react-vite'
2+
23
const config: StorybookConfig = {
34
stories: ['./stories/**/*.mdx', './stories/**/*.stories.@(js|jsx|ts|tsx)'],
45
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-interactions'],
56
framework: {
6-
name: '@storybook/react-webpack5',
7+
name: '@storybook/react-vite',
78
options: {},
89
},
10+
async viteFinal(config, options) {
11+
// Add your configuration here
12+
return config
13+
},
914
docs: {
1015
autodocs: 'tag',
1116
},

package.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@
5353
"three-stdlib": "^2.21.10"
5454
},
5555
"devDependencies": {
56-
"@babel/core": "^7.21.8",
57-
"@babel/plugin-transform-runtime": "^7.21.4",
58-
"@babel/preset-env": "^7.21.5",
59-
"@babel/preset-react": "^7.18.6",
60-
"@babel/preset-typescript": "^7.21.5",
6156
"@react-three/fiber": "^8.13.0",
6257
"@rollup/plugin-babel": "^6.0.3",
6358
"@rollup/plugin-commonjs": "^24.1.0",
@@ -68,7 +63,7 @@
6863
"@storybook/addon-links": "^7.0.10",
6964
"@storybook/blocks": "^7.0.10",
7065
"@storybook/react": "^7.0.10",
71-
"@storybook/react-webpack5": "^7.0.10",
66+
"@storybook/react-vite": "^7.0.11",
7267
"@storybook/testing-library": "^0.0.14-next.2",
7368
"@types/react": "^18.2.0",
7469
"@types/react-dom": "^18.2.1",
@@ -95,7 +90,8 @@
9590
"semantic-release": "^21.0.2",
9691
"storybook": "^7.0.10",
9792
"three": "^0.151.3",
98-
"typescript": "^5.0.4"
93+
"typescript": "^5.0.4",
94+
"vite": "^4.3.5"
9995
},
10096
"peerDependencies": {
10197
"@react-three/fiber": ">=8.0",

rollup.config.js

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,23 @@
11
import path from 'path'
2-
import babel from '@rollup/plugin-babel'
32
import resolve from '@rollup/plugin-node-resolve'
43
import filesize from 'rollup-plugin-filesize'
4+
import typescript from '@rollup/plugin-typescript'
55

66
const root = process.platform === 'win32' ? path.resolve('/') : '/'
77
const external = (id) => !id.startsWith('.') && !id.startsWith(root)
88
const extensions = ['.js', '.jsx', '.ts', '.tsx']
99

10-
const getBabelOptions = () => ({
11-
babelrc: false,
12-
extensions,
13-
exclude: '**/node_modules/**',
14-
babelHelpers: 'runtime',
15-
presets: [
16-
[
17-
'@babel/preset-env',
18-
{
19-
targets: '> 1%, not dead, not ie 11, not op_mini all',
20-
},
21-
],
22-
'@babel/preset-react',
23-
'@babel/preset-typescript',
24-
],
25-
plugins: [['@babel/transform-runtime', { regenerator: false, useESModules: true }]],
26-
})
27-
2810
export default [
2911
{
3012
input: `./src/index.tsx`,
3113
output: { file: `dist/index.js`, format: 'esm' },
3214
external,
33-
plugins: [babel(getBabelOptions()), resolve({ extensions }), filesize()],
15+
plugins: [typescript(), resolve({ extensions }), filesize()],
3416
},
3517
{
3618
input: `./src/index.tsx`,
3719
output: { file: `dist/index.cjs`, format: 'cjs' },
3820
external,
39-
plugins: [babel(getBabelOptions()), resolve({ extensions }), filesize()],
21+
plugins: [typescript(), resolve({ extensions }), filesize()],
4022
},
4123
]

0 commit comments

Comments
 (0)