我正在使用 Fresh,我想使用两个 Tailwind 插件:
daisyUI
和 @tailwindcss/typography
。我不使用单独的导入映射。全部都在里面deno.jsonc
。如果我只使用 daisyUI
插件,那么它就可以正常工作。但是当它 @tailwindcss/typography
: 时我收到此错误
error: Uncaught (in promise) TypeError: Relative import path "typography" not prefixed with / or ./ or ../ and not in import map from "file:///D:/QC%20supplements/Code/Apps/Tr%E1%BA%A5n%20K%E1%BB%B3/Web/tailwind.config.ts"
我想这是因为插件名称包含特殊字符,导致很难正确执行路径,但我不知道如何修复。
这是我的代码:
deno.jsonc
:
"imports": {
"$fresh/": "https://deno.land/x/[email protected]/",
"preact": "https://esm.sh/[email protected]",
"preact/": "https://esm.sh/[email protected]/",
"@preact/signals": "https://esm.sh/*@preact/[email protected]",
"@preact/signals-core": "https://esm.sh/*@preact/[email protected]",
"tailwindcss": "npm:[email protected]",
"tailwindcss/": "npm:/[email protected]/",
"tailwindcss/plugin": "npm:/[email protected]/plugin.js",
"typography": "npm:@tailwindcss/typography",
"daisyui": "npm:[email protected]",
"$std/": "https://deno.land/[email protected]/",
"deno.importMap": "./import_map.json"
}
tailwind.config.js
:
import { type Config } from "tailwindcss";
import typography from "typography"
import daisyui from "daisyui";
export default {
content: [
"{routes,islands,components}/**/*.{ts,tsx}",
],
plugins: [typography, daisyui],
daisyui: {
themes: ["light", "dark", "lemonade", "autumn", "aqua", "nord" ],
logs: false
},
} satisfies Config
我哪里错了?
相关文章:
我简直不敢相信自己的眼睛。我做了一个测试仓库,发现它仍然有效。我怀疑这是因为我的文件夹结构,因为新代码位于
Web
文件夹中,而不是根目录中。然后我添加导入地图:
"typography": "npm:@tailwindcss/typography",
到
Web/deno.json
,而不是./deno.json
,导入成功!
对我来说这似乎是一个错误。另请参阅此相关错误:如何解决错误:“相对导入路径“$fresh/dev.ts”未以 / 或 ./ 或 ../ 为前缀”