You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are curious how vite-plugin-ssr automagically imports files living at dist/server/, then read on.
Normally importing dist/server/importBuild.cjs as described in vite-plugin-ssr.com/importBuild.cjs should fix your situation and there is nothing more for you to know.
But, if you curious, this is what is going.
Trick 1
Trick 1: vite-plugin-ssr uses a little Vite plugin vite-plugin-import-build that automatically generates a file that imports dist/server/importBuild.cjs on our behalf:
If we install npm packages after running $ vite build, then autoImporter.js is erased.
(Because vite-plugin-import-build generates node_modules/vite-plugin-import-build/dist/autoImporter.js at build-time when we run $ vite build. So, if we $ rm -r node_modules/ && npm install, then the link living at node_modules/vite-plugin-import-build/dist/autoImporter.js is erased.)
When using Yarn PnP which installs dependencies in an immutable way.
(Because this means that vite-plugin-import-build cannot generate node_modules/vite-plugin-import-build/dist/autoImporter.js.)
In theses situations, vite-plugin-ssr uses a second trick.
Trick 2
Trick 2: vite-plugin-ssr dynamically searches for dist/server/importBuild.cjs and loads it.
Normally importing
dist/server/importBuild.cjs
as described in vite-plugin-ssr.com/importBuild.cjs should fix your situation and there is nothing more for you to know.But, if you curious, this is what is going.
Trick 1
Trick 1: vite-plugin-ssr uses a little Vite plugin vite-plugin-import-build that automatically generates a file that imports
dist/server/importBuild.cjs
on our behalf:This trick doesn't work:
$ vite build
, thenautoImporter.js
is erased.In theses situations, vite-plugin-ssr uses a second trick.
Trick 2
Trick 2: vite-plugin-ssr dynamically searches for
dist/server/importBuild.cjs
and loads it.But that doesn't work:
vite.config.js#build.outDir
.Fallback
If both tricks don't work, then we fallback to manually import
dist/server/importBuild.cjs
as described in vite-plugin-ssr.com/importBuild.cjs.The text was updated successfully, but these errors were encountered: