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
The file is served correctly during development, but when I call build (node --require esbuild-register node_modules/.bin/eleventy), the src of my script tag is unchanged. Although, Vite recognizes the path to the css file and processes that correctly.
A follow-up on my further investigation. Turns out that Vite post-processing is done on the _site directory. That means, by Vite convention, it will only process/copy JavaScript files under _site/public.
This creates a weird difference between development and production-build modes. I'm still investigating, but any ideas are welcome.
I've prepared a minimal eleventy+eleventy-plugin-vite+video.js demo[1], basically I'm reference the node modules like this (shortened for the sake of exemplification, Disclaimer: I'm not an expert in this asset bundling business):
👋 Hello,
I'm trying to get Vite to process JavaScript files resolved from
node_modules
on the build step, but it skips them entirely, leaving my site broken.Here is my Vite configuration with the
resolve
keyword.And here is my script tag from the file template.
The file is served correctly during development, but when I call
build
(node --require esbuild-register node_modules/.bin/eleventy
), thesrc
of my script tag is unchanged. Although, Vite recognizes the path to the css file and processes that correctly.Vite suggest to add a
type="module"
to the script, but it breaks the dependency.I'm unsure if this is a bug in the plugin, Vite, or a combination of the two. If anything, this might be a "heads up" kind of issue.
The text was updated successfully, but these errors were encountered: