Support for assets from node_modules and import.meta.url? #3518
Unanswered
michaelfranzl
asked this question in
Q&A
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I have a module
mymodule
innode_modules
with the following file structure:Inside
lib.js
I useimport.meta.url
to calculate the absolute path tolib.svg
. This is necessary because I need tofetch
the contents of the SVG file to parse it, and as paths are always page-relative, and not file-relative, there seems to be no other way. This technique seems to be directly supported 1 and it indeed works natively in the browser (plain ES6, without running any transformations, like bundling or packaging).Now, from that,
snowpack build
generates the following file structure:But,
lib.svg
is ignored and missing.I put
mymodule/lib/lib.svg
intoknownEntrypoints
, but the build command still does not install the file into the build directory.Does Snowpack support this use case? How can I get at
lib.svg
when runningsnowpack dev
as well assnowpack build
?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions