-
Is there a way to import a text file as a string? With rollup I have a plugin that takes care of this, can't figure out how to get this to happen with snowpack. |
Beta Was this translation helpful? Give feedback.
Answered by
meh
Nov 28, 2020
Replies: 2 comments 1 reply
-
Welp, just wrote my own thing: https://github.com/meh/snowpack-plugin-string |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
meh
-
In some use cases the option of fetching the text content of the file can be used ./file.txt
./main.ts // main.ts
const resp = await fetch(import.meta.url+'../file.txt');
const text = await resp.text(); or // main.ts
const resp = await fetch(new URL('./files.txt', import.meta.url).href);
const text = await resp.text(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Welp, just wrote my own thing: https://github.com/meh/snowpack-plugin-string