Skip to content
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

vite preview does not start server #15743

Closed
7 tasks done
Stadly opened this issue Jan 29, 2024 · 3 comments
Closed
7 tasks done

vite preview does not start server #15743

Stadly opened this issue Jan 29, 2024 · 3 comments
Labels
bug: upstream Bug in a dependency of Vite

Comments

@Stadly
Copy link

Stadly commented Jan 29, 2024

Describe the bug

When I run npx vite build && npx vite preview, the server is not started. It seems like npx vite preview just exists, without any output.

I have created as small a reproduction as I could manage. It is quite strange, since it involves dynamic import, an environment variable, setting a property on global, JSON.stringify, an if statement, and more. If I remove any of the elements, npx vite preview starts working again 🤔

But my use case involves all those things, so it would be great if it could be fixed :)

Reproduction

https://github.com/Stadly/reproduction/tree/vite/dynamic-import

Steps to reproduce

Run npx vite build followed by npx vite preview

System Info

System:
    OS: Linux 5.15 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 8.25 GB / 15.50 GB
    Container: Yes
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 20.10.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.14.0 - /usr/local/share/npm-global/bin/pnpm
  npmPackages:
    vite: ^5.0.3 => 5.0.12

Used Package Manager

npm

Logs

Click to expand!
npx vite preview --debug
  vite:config bundled config file loaded in 390.38ms +0ms
  vite:config using resolved config: {
  vite:config   plugins: [
  vite:config     'vite:optimized-deps',
  vite:config     'vite:watch-package-data',
  vite:config     'vite:pre-alias',
  vite:config     'alias',
  vite:config     'vite-plugin-svelte',
  vite:config     'vite-plugin-svelte-inspector',
  vite:config     'vite:modulepreload-polyfill',
  vite:config     'vite:resolve',
  vite:config     'vite:html-inline-proxy',
  vite:config     'vite:css',
  vite:config     'vite:esbuild',
  vite:config     'vite:json',
  vite:config     'vite:wasm-helper',
  vite:config     'vite:worker',
  vite:config     'vite:asset',
  vite:config     'vite-plugin-sveltekit-setup',
  vite:config     'vite-plugin-sveltekit-virtual-modules',
  vite:config     'vite-plugin-sveltekit-guard',
  vite:config     'vite-plugin-sveltekit-compile',
  vite:config     'vite:wasm-fallback',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:worker-import-meta-url',
  vite:config     'vite:asset-import-meta-url',
  vite:config     'vite:dynamic-import-vars',
  vite:config     'vite:import-glob',
  vite:config     'vite:client-inject',
  vite:config     'vite:import-analysis'
  vite:config   ],
  vite:config   build: {
  vite:config     target: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari14' ],
  vite:config     cssTarget: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari14' ],
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  vite:config     sourcemap: false,
  vite:config     rollupOptions: {
  vite:config       input: '/workspaces/typescript-node/node_modules/@sveltejs/kit/src/runtime/client/entry.js'
  vite:config     },
  vite:config     minify: 'esbuild',
  vite:config     terserOptions: {},
  vite:config     write: true,
  vite:config     emptyOutDir: null,
  vite:config     copyPublicDir: true,
  vite:config     manifest: false,
  vite:config     lib: false,
  vite:config     ssr: false,
  vite:config     ssrManifest: false,
  vite:config     ssrEmitAssets: false,
  vite:config     reportCompressedSize: true,
  vite:config     chunkSizeWarningLimit: 500,
  vite:config     watch: null,
  vite:config     commonjsOptions: { include: [Array], extensions: [Array] },
  vite:config     dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] },
  vite:config     modulePreload: { polyfill: true },
  vite:config     cssMinify: true
  vite:config   },
  vite:config   preview: {
  vite:config     port: undefined,
  vite:config     strictPort: undefined,
  vite:config     host: undefined,
  vite:config     https: undefined,
  vite:config     open: undefined,
  vite:config     proxy: undefined,
  vite:config     cors: { preflightContinue: true },
  vite:config     headers: undefined
  vite:config   },
  vite:config   resolve: {
  vite:config     mainFields: [ 'svelte', 'browser', 'module', 'jsnext:main', 'jsnext' ],
  vite:config     conditions: [ 'svelte' ],
  vite:config     extensions: [
  vite:config       '.mjs',  '.js',
  vite:config       '.mts',  '.ts',
  vite:config       '.jsx',  '.tsx',
  vite:config       '.json'
  vite:config     ],
  vite:config     dedupe: [
  vite:config       'svelte/animate',
  vite:config       'svelte/easing',
  vite:config       'svelte/internal',
  vite:config       'svelte/internal/disclose-version',
  vite:config       'svelte/motion',
  vite:config       'svelte/ssr',
  vite:config       'svelte/store',
  vite:config       'svelte/transition',
  vite:config       'svelte',
  vite:config       'svelte-hmr/runtime/hot-api-esm.js',
  vite:config       'svelte-hmr/runtime/proxy-adapter-dom.js',
  vite:config       'svelte-hmr'
  vite:config     ],
  vite:config     preserveSymlinks: false,
  vite:config     alias: [ [Object], [Object], [Object], [Object], [Object] ]
  vite:config   },
  vite:config   optimizeDeps: {
  vite:config     disabled: 'build',
  vite:config     include: [
  vite:config       'svelte/animate',
  vite:config       'svelte/easing',
  vite:config       'svelte/internal',
  vite:config       'svelte/internal/disclose-version',
  vite:config       'svelte/motion',
  vite:config       'svelte/store',
  vite:config       'svelte/transition',
  vite:config       'svelte'
  vite:config     ],
  vite:config     exclude: [ 'svelte-hmr', '@sveltejs/kit', '$app', '$env' ],
  vite:config     extensions: [ '.svelte' ],
  vite:config     esbuildOptions: { preserveSymlinks: false, plugins: [Array] }
  vite:config   },
  vite:config   ssr: {
  vite:config     target: 'node',
  vite:config     external: [
  vite:config       'set-cookie-parser',
  vite:config       '@auth/core',
  vite:config       'cookie',
  vite:config       'set-cookie-parser'
  vite:config     ],
  vite:config     noExternal: [
  vite:config       'svelte',
  vite:config       /^svelte\//,
  vite:config       '@auth/sveltekit',
  vite:config       'esm-env',
  vite:config       '@sveltejs/kit'
  vite:config     ],
  vite:config     optimizeDeps: { disabled: true, esbuildOptions: [Object] }
  vite:config   },
  vite:config   experimental: { importGlobRestoreExtension: false, hmrPartialAccept: true },
  vite:config   root: '/workspaces/typescript-node',
  vite:config   server: {
  vite:config     preTransformRequests: true,
  vite:config     cors: { preflightContinue: true },
  vite:config     fs: {
  vite:config       strict: true,
  vite:config       allow: [Array],
  vite:config       deny: [Array],
  vite:config       cachedChecks: false
  vite:config     },
  vite:config     sourcemapIgnoreList: [Function: sourcemapIgnoreList],
  vite:config     watch: { ignored: [Array] },
  vite:config     middlewareMode: false
  vite:config   },
  vite:config   define: {
  vite:config     __SVELTEKIT_APP_VERSION_POLL_INTERVAL__: '0',
  vite:config     __SVELTEKIT_DEV__: 'true',
  vite:config     __SVELTEKIT_EMBEDDED__: 'false'
  vite:config   },
  vite:config   appType: 'custom',
  vite:config   base: '/',
  vite:config   publicDir: '/workspaces/typescript-node/static',
  vite:config   configFile: '/workspaces/typescript-node/vite.config.js',
  vite:config   configFileDependencies: [ '/workspaces/typescript-node/vite.config.js' ],
  vite:config   inlineConfig: {
  vite:config     root: undefined,
  vite:config     base: undefined,
  vite:config     configFile: undefined,
  vite:config     logLevel: undefined,
  vite:config     mode: undefined,
  vite:config     build: { outDir: undefined },
  vite:config     preview: {
  vite:config       port: undefined,
  vite:config       strictPort: undefined,
  vite:config       host: undefined,
  vite:config       open: undefined
  vite:config     }
  vite:config   },
  vite:config   rawBase: '/',
  vite:config   cacheDir: '/workspaces/typescript-node/node_modules/.vite',
  vite:config   command: 'serve',
  vite:config   mode: 'production',
  vite:config   isWorker: false,
  vite:config   mainConfig: null,
  vite:config   isProduction: true,
  vite:config   css: { lightningcss: undefined },
  vite:config   esbuild: { jsxDev: false },
  vite:config   envDir: '/workspaces/typescript-node',
  vite:config   env: { BASE_URL: '/', MODE: 'production', DEV: false, PROD: true },
  vite:config   assetsInclude: [Function: assetsInclude],
  vite:config   logger: {
  vite:config     hasWarned: false,
  vite:config     info: [Function: info],
  vite:config     warn: [Function: warn],
  vite:config     warnOnce: [Function: warnOnce],
  vite:config     error: [Function: error],
  vite:config     clearScreen: [Function: clearScreen],
  vite:config     hasErrorLogged: [Function: hasErrorLogged]
  vite:config   },
  vite:config   packageCache: Map(1) {
  vite:config     'fnpd_/workspaces/typescript-node' => {
  vite:config       dir: '/workspaces/typescript-node',
  vite:config       data: [Object],
  vite:config       hasSideEffects: [Function: hasSideEffects],
  vite:config       webResolvedImports: {},
  vite:config       nodeResolvedImports: {},
  vite:config       setResolvedCache: [Function: setResolvedCache],
  vite:config       getResolvedCache: [Function: getResolvedCache]
  vite:config     },
  vite:config     set: [Function (anonymous)]
  vite:config   },
  vite:config   createResolver: [Function: createResolver],
  vite:config   worker: { format: 'iife', plugins: '() => plugins', rollupOptions: {} },
  vite:config   getSortedPlugins: [Function: getSortedPlugins],
  vite:config   getSortedPluginHooks: [Function: getSortedPluginHooks]
  vite:config } +90ms

Validations

@bluwy
Copy link
Member

bluwy commented Jan 30, 2024

On mobile at the moment so couldn't test it out, but the issue might be this: rollup/rollup#4708

@XiSenao XiSenao added bug: upstream Bug in a dependency of Vite and removed pending triage labels Jan 31, 2024
@bluwy
Copy link
Member

bluwy commented Feb 21, 2024

Seems like this is an upstream issue and not much can be done in Vite. I'll close this in favour of rollup/rollup#4708

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Feb 21, 2024
@Stadly
Copy link
Author

Stadly commented Feb 21, 2024

Actually, I think it is an issue with SvelteKit's adapter-node: sveltejs/kit#11763

@github-actions github-actions bot locked and limited conversation to collaborators Mar 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: upstream Bug in a dependency of Vite
Projects
None yet
Development

No branches or pull requests

3 participants