From 14c004da79014d9d47e82169a16c0f36df410d18 Mon Sep 17 00:00:00 2001 From: Hans Schallmoser <99032404+hansSchall@users.noreply.github.com> Date: Fri, 18 Oct 2024 17:33:55 +0200 Subject: [PATCH] docs: Asset/CSS imports --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index 07b6c59..d73d690 100644 --- a/README.md +++ b/README.md @@ -317,6 +317,24 @@ If you want a lightweight solution, check out ## FAQ / Known limitations +### Asset imports + +Importing assets like `import imgUrl from './img.png'` will throw errors, because Deno simply cannot handle such +imports. Currently it is not even possible to exclude these files :-( + +Instead of asset imports you should use `const imgUrl = new URL("/img.png", import.meta.url).href` which provides +exactly the same functionality while being compatible with Deno. + +### CSS imports + +Similar to asset imports, CSS imports are vite-only, so Deno complains about them... + +**Solution 1:** Import your CSS directly from the HTML + +**Solution 2:** Import your CSS fom a JS file that is imported from the HTML, excluded from this plugin and not imported +from the rest of the JS/TS code (like this one: +[examples/preact/src/style-import.js](examples/preact/src/style-import.js)) + ### React does not work (and maybe more packages that do ugly things with exports) See [Usage with React](#usage-with-react)