-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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]: /virtual:/@storybook/builder-vite/setup-addons.js" points to missing source files #28567
Comments
** Disclaimer** This information might be inaccurate, due to it being generated automatically
// vite-config.ts
export async function commonConfig(options: Options, _type: PluginConfigType): Promise<ViteInlineConfig> {
const configEnv = _type === 'development' ? configEnvServe : configEnvBuild;
const { loadConfigFromFile, mergeConfig } = await import('vite');
const { viteConfigPath } = await getBuilderOptions<BuilderOptions>(options);
const projectRoot = path.resolve(options.configDir, '..');
const { config: { build: buildProperty = undefined, ...userConfig } = {} } =
(await loadConfigFromFile(configEnv, viteConfigPath, projectRoot)) ?? {};
const sbConfig: InlineConfig = {
configFile: false,
cacheDir: resolvePathInStorybookCache('sb-vite', options.cacheKey),
root: projectRoot,
base: './',
plugins: await pluginConfig(options),
resolve: {
conditions: ['storybook', 'stories', 'test', 'browser', 'import', 'module', 'default'],
preserveSymlinks: isPreservingSymlinks(),
alias: {
assert: require.resolve('browser-assert'),
},
},
envPrefix: userConfig.envPrefix ? ['STORYBOOK_'] : ['VITE_', 'STORYBOOK_'],
build: {
target: buildProperty?.target,
sourcemap: true, // Ensure sourcemap is enabled
},
};
const config: ViteConfig = mergeConfig(userConfig, sbConfig);
return config;
}
// vite-config.ts
export async function pluginConfig(options: Options) {
const frameworkName = await getFrameworkName(options);
const build = await options.presets.apply('build');
const externals: Record<string, string> = globalsNameReferenceMap;
if (build?.test?.disableBlocks) {
externals['@storybook/blocks'] = '__STORYBOOK_BLOCKS_EMPTY_MODULE__';
}
const plugins = [
codeGeneratorPlugin(options),
await csfPlugin(options),
await injectExportOrderPlugin(),
await stripStoryHMRBoundary(),
{
name: 'storybook:allow-storybook-dir',
enforce: 'post',
config(config) {
if (config?.server?.fs?.allow) {
config.server.fs.allow.push('.storybook');
}
},
},
await externalGlobalsPlugin(externals),
pluginWebpackStats({ workingDir: process.cwd() }),
] as PluginOption[];
if (frameworkName === '@storybook/glimmerx-vite') {
const plugin = require('vite-plugin-glimmerx/index.cjs');
plugins.push(plugin.default());
}
return plugins;
}
// index.ts
export const start: ViteBuilder['start'] = async ({ startTime, options, router, server: devServer }) => {
server = await createViteServer(options as Options, devServer);
const previewResolvedDir = join(corePath, 'dist/preview');
const previewDirOrigin = previewResolvedDir;
router.use(`/sb-preview`, express.static(previewDirOrigin, { immutable: true, maxAge: '5m' }));
router.use(iframeMiddleware(options as Options, server));
router.use(server.middlewares);
return {
bail,
stats: {
toJson: () => {
throw new NoStatsForViteDevError();
},
},
totalTime: process.hrtime(startTime),
};
}; These changes should ensure that the source maps are correctly generated and point to the correct source files. References/code/builders/builder-vite/src/index.ts
|
Upgraded from
...and so on @valentinpalkovic believes the docs error I'm facing inside here has no relation to missing source files, so de-emphasizing it hereI am guessing this is what's causing my `parameters.docs.source.transform`'s `code` parameter to be undefined and basically error out with the following in any of my component's docs page: |
@Loic57 Can you create another GitHub issue related to your HMR issue in Stencil? |
@kerryj89 I don't think your issue is related to the issue of missing source files. Can you please create another GitHub issue? |
I was facing the same issue today after upgrading to 8.2.4 So Ive downgraded back to 7.6.20 |
@David05500 Except of having a nasty warning in the terminal Storybook should still function. I wouldn’t recommend to downgrade just because of it. You could upgrade to 8.1.11. This version is not containing the issue. |
I also got the same error. Reproduction steps:
Reproduction repo:
Full log:
|
I have similar issue as @phamhongphuc on Yarn 4 PnP and Storybook Vite 8.2.5. It seems deleting For the virtual modules, there is forward slash ( // Virtual modules should be prefixed with a null byte to avoid a
// false positive "missing source" warning. We also check for certain
// prefixes used for special handling in esbuildDepPlugin.
const virtualSourceRE = /^(?:dep:|browser-external:|virtual:)|\0/ Is there a reason why source maps are generated for |
@valentinpalkovic Do you know what's causing this? |
Not yet! I can investigate it next week as part of my empathy week! |
I encountered the same logs. Meanwhile I guess downgrading is the fix.
|
I don't see any functional issues even though the warning appears in the terminal. Has anyone encountered any actual failures anywhere? My deps now:
|
Any update on this? I use storybook 8.2.7 with a new react (with vite) project and it also appears to me: Sourcemap for "/virtual:/@storybook/builder-vite/setup-addons.js" points to missing source files
Sourcemap for "/virtual:/@storybook/builder-vite/vite-app.js" points to missing source files |
I'm getting the same errors, with Storybook
|
I also am experiencing:
In addition, HMR is not working. I am on Vite 5.3.5, storybook 8.2.7 (in react). |
I can confirm this bug in a Vue + Vite + Storybook project. I just upgraded to Storybook 8.2.7 from Storybook 7. |
Does anyone else here have problem with autodocs not shoing up the table for props, emits and so on? I'm starting to think that this warning in the console has something to do with autodocs pages bascially being empty. Only the args that I define for a story are shown as well as their controls. But If I don't define any args explicitly, the autodocs page is basically empty and thus useless. |
@Walnussbaer For me, it's not related to this issue. Try with the version 8.1 of storybook, if you have also the autodocs problem, looks at the new vue docgen option in >= 8.0 : https://storybook.js.org/docs/get-started/frameworks/vue3-vite?renderer=vue#using-vue-component-meta options: {
+ docgen: 'vue-component-meta',
}, |
I downgraded to 8.1.11 but still no meaningful autodocs page (I was already using |
BTW: I created a sandbox project with the Storybook CLI ( When I start the storybook instance in this new and clean project, even then I get the following errors:
|
Still an issue, v8.2.9
|
I can confirm that issue still persist with storybook v8.2.9 and Vite + react. |
Yes, the fix of the issue was reverted, and it's still in progress for the next 8.3 : #28867 |
I'm experiencing the same issue with Storybook 8.2.9, too. |
Tested in 8.3.0-beta.0 and still seeing this issue |
+1 |
I can confirm that with version |
Thanks for sorting this out 🥳 |
Describe the bug
When starting or building Storybook in a Vite project, the following lines are logged to the terminal:
In Vite 4 projects, even more files might be affected.
Reproduction steps
The text was updated successfully, but these errors were encountered: