Replies: 4 comments 1 reply
-
|
You can access the define config using Unfortunately changing it dynamically in vite/packages/vite/src/node/plugins/define.ts Line 111 in 3123eb7 It would be really great if vite could let us change defines dynamically like this. We want a |
Beta Was this translation helpful? Give feedback.
-
|
I've managed to do this by replacing the token manually in the transform hook: NOTE: This is just a dumb string transform like vite 4 used to do. |
Beta Was this translation helpful? Give feedback.
-
|
...except that only updates if you change the file that |
Beta Was this translation helpful? Give feedback.
-
|
Ok this works, using The other option is to have your plugin provide a virtual module instead that exports the things you want. vite-plugin-virtual may be of interest if you want to go that way. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
my goal is to have a simple BUILD_DATE define that updates on
buildStart.if i do something like this:
the
confighook inyarn build --watchmode gets only triggered on the first start.so any builds triggered by the actual watch does not get a new
BUILD_DATE.i did not find any info / how to access the config from within the
buildStartHook.maybe i am missing something obvious ore it is just not possible this way.
i am open for any tips and hints :-)
Beta Was this translation helpful? Give feedback.
All reactions