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

figure out ssr.optimizeDeps for vite-node-miniflare #151

Closed
hi-ogawa opened this issue Jan 9, 2024 · 0 comments · Fixed by #152
Closed

figure out ssr.optimizeDeps for vite-node-miniflare #151

hi-ogawa opened this issue Jan 9, 2024 · 0 comments · Fixed by #152

Comments

@hi-ogawa
Copy link
Owner

hi-ogawa commented Jan 9, 2024

Initially, I gave up vite-node's prebundling for vite-node-miniflare + react demo, then later ended up with creating my own pre-bundling plugin:

but maybe optimizeDeps was never made to work in vite-node ssr as explained in this issue:

Quick workaround could be to trigger dummy ssrLoadModule in configureServer hook?

https://stackblitz.com/edit/vitest-dev-vitest-8wf26p?file=vite.config.ts

import { defineConfig } from 'vite';

export default defineConfig({
  plugins: [
    {
      name: 'force-ssr-optimize-deps',
      configureServer(server) {
        return async () => {
          console.log('[trigger ssrLoadModule]');
          const mod = await server.ssrLoadModule('/dummy-module.js');
          console.log('[dummy-module]', mod);
        };
      },
    },
  ],
});
@hi-ogawa hi-ogawa changed the title Figure out optimizeDeps for vite-node-miniflara figure out optimizeDeps for vite-node-miniflara Jan 9, 2024
@hi-ogawa hi-ogawa changed the title figure out optimizeDeps for vite-node-miniflara figure out optimizeDeps for vite-node-miniflare Jan 9, 2024
@hi-ogawa hi-ogawa changed the title figure out optimizeDeps for vite-node-miniflare figure out ssr.optimizeDeps for vite-node-miniflare Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant