-
-
Notifications
You must be signed in to change notification settings - Fork 330
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
Error: Cannot find module '../../../../dist/server/importBuild.cjs' #627
Comments
I'll need a reproduction. |
@brillout reproduction:
|
@brillout It seems like that file is pointing to the wrong place: {
const { setLoaders } = require('../../node_modules/vite-plugin-ssr/dist/cjs/node/plugin/plugins/importBuild/loadBuild.js');
setLoaders({
pageFiles: () => import('./pageFiles.js'),
clientManifest: () => require('../client/manifest.json'),
pluginManifest: () => require('../client/vite-plugin-ssr.json'),
});
} After moving |
VPS assumes that you don't move |
@brillout Since the webpack era, the For reference I have opened an issue in vavite regarding this (cyco130/vavite#24). |
@brillout Well, I see from #403 that it won't work if we want to bundle all the server code into a single file. One of my dreams is being able to have a truly standalone server build with Vite, just like it used to be with Webpack, this would be the ultimate Vite setup! Well, I see that it still too early for that, maybe in the future the community will go in that direction. |
Using |
Description
After building server code with Vavite, then copying
node_modules
intoserver/node_modules
, VPS was unable to locate the project root.With a quick search, I see that relative paths are hardcoded in the plugin code, without taking into account the possibility of building server code, changing
node_modules
location or using/dist
standalone (e.g. copying/dist/client
and/dist/server
to the project root).Error Message + Error Stack
Error: Cannot find module '../../../../dist/server/importBuild.cjs' Require stack: - /usr/src/app/dist/server/node_modules/@brillout/vite-plugin-import-build/dist/autoImporter.js - /usr/src/app/dist/server/node_modules/@brillout/vite-plugin-import-build/dist/loadBuild/index.js - /usr/src/app/dist/server/node_modules/@brillout/vite-plugin-import-build/loadBuild.js - /usr/src/app/dist/server/node_modules/vite-plugin-ssr/dist/cjs/node/plugin/plugins/importBuild/loadBuild.js - /usr/src/app/dist/server/node_modules/vite-plugin-ssr/dist/cjs/node/runtime/globalContext.js - /usr/src/app/dist/server/node_modules/vite-plugin-ssr/dist/cjs/node/runtime/html/injectAssets/getViteDevScripts.js - /usr/src/app/dist/server/node_modules/vite-plugin-ssr/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js - /usr/src/app/dist/server/node_modules/vite-plugin-ssr/dist/cjs/node/runtime/html/injectAssets.js - /usr/src/app/dist/server/node_modules/vite-plugin-ssr/dist/cjs/node/runtime/html/renderHtml.js - /usr/src/app/dist/server/node_modules/vite-plugin-ssr/dist/cjs/node/runtime/renderPage/renderPageContext.js - /usr/src/app/dist/server/node_modules/vite-plugin-ssr/dist/cjs/node/runtime/renderPage.js - /usr/src/app/dist/server/node_modules/vite-plugin-ssr/dist/cjs/node/index.js - /usr/src/app/dist/server/index.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15) at Function.Module._load (node:internal/modules/cjs/loader:841:27) at Module.require (node:internal/modules/cjs/loader:1067:19) at require (node:internal/modules/cjs/helpers:103:18) at Object.exports.load (/usr/src/app/dist/server/node_modules/@brillout/vite-plugin-import-build/dist/autoImporter.js:2:24) at loadBuild (/usr/src/app/dist/server/node_modules/@brillout/vite-plugin-import-build/dist/loadBuild/index.js:15:18) at loadBuild (/usr/src/app/dist/server/node_modules/vite-plugin-ssr/dist/cjs/node/plugin/plugins/importBuild/loadBuild.js:15:72) at initGlobalContext (/usr/src/app/dist/server/node_modules/vite-plugin-ssr/dist/cjs/node/runtime/globalContext.js:36:62) at Object.renderPage (/usr/src/app/dist/server/node_modules/vite-plugin-ssr/dist/cjs/node/runtime/renderPage.js:22:53) at /usr/src/app/dist/server/index.js:2:3009
The text was updated successfully, but these errors were encountered: