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
I am using vite to create a bundle of a couple of typescript files for production. I use PRODUCTION mode to generate this bundle which is going to be used directly by NodeJS at backend side.
The generated bundle is perfect except that it has imports with absolute path rather than retaining package imports.
import L from "/Users/abc/Workspace/Programs/fc/lp/node_modules/express/index.js";
import i from "/Users/abc/Workspace/Programs/fc/lp/node_modules/winston/dist/winston.js";
Where fc/lp is the folder which contains the source code from where I am running this vite process.
The problem is that the absolute path is not valid at the place where the build file is going to be deployed and run. How do I ensure that package imports are retained or atleast it uses relative path for accessing node_modules files
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am using vite to create a bundle of a couple of typescript files for production. I use PRODUCTION mode to generate this bundle which is going to be used directly by NodeJS at backend side.
This is my config
The generated bundle is perfect except that it has imports with absolute path rather than retaining package imports.
Where fc/lp is the folder which contains the source code from where I am running this vite process.
The problem is that the absolute path is not valid at the place where the build file is going to be deployed and run. How do I ensure that package imports are retained or atleast it uses relative path for accessing node_modules files
Beta Was this translation helpful? Give feedback.
All reactions