New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: HMR of preview.tsx
is not working
#26881
Labels
Comments
Currently, as a countermeasure, I am using a plugin called import type { StorybookConfig } from "@storybook/react-vite"
import { InlineConfig, UserConfig, mergeConfig } from "vite"
import path, { dirname, join } from "path"
const config: StorybookConfig = {
framework: getAbsolutePath("@storybook/react-vite"),
core: {
disableTelemetry: true,
},
stories: ["../stories/**/*.@(mdx|stories.@(tsx))"],
addons: [
getAbsolutePath("@storybook/addon-viewport"),
getAbsolutePath("@storybook/addon-docs"),
getAbsolutePath("@storybook/addon-a11y"),
getAbsolutePath("@storybook/addon-backgrounds"),
getAbsolutePath("@storybook/addon-measure"),
getAbsolutePath("@storybook/addon-storysource"),
getAbsolutePath("storybook-dark-mode"),
],
viteFinal: async (config) => {
config = mergeConfig<InlineConfig, UserConfig>(config, {
+ plugins: [
+ {
+ name: "force-reload-on-specific-files",
+ handleHotUpdate: ({ file, server }) => {
+ const isTheme = file.startsWith(
+ path.resolve(__dirname, "../packages/theme/src"),
+ )
+ const isProviders = file.startsWith(
+ path.resolve(__dirname, "../packages/providers/src"),
+ )
+
+ if (isTheme || isProviders) {
+ server.hot.send({ type: "full-reload" })
+ }
+ },
+ },
+ ],
resolve: {
alias: [
{
find: /\@yamada-ui\/react$/,
replacement: path.resolve(__dirname, "../packages/react/src"),
},
{
find: /\@yamada-ui\/theme$/,
replacement: path.resolve(__dirname, "../packages/theme/src"),
},
],
},
})
config.esbuild = undefined
return config
},
typescript: {
reactDocgen: false,
},
}
export default config
function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, "package.json")))
} |
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
After upgrading to v8, HMR no longer works for
preview.tsx
.To Reproduce
preview.tsx
components.tsx
Until v7, updating the
StoryProvider
in thedecorators
, i.e.UIProvider
, made HMR work.System
Additional context
No response
The text was updated successfully, but these errors were encountered: