gpt4 book ai didi

svelte - Rollup 无法解析 vite 中的 alias(@)

转载 作者:行者123 更新时间:2023-12-05 03:28:39 29 4
gpt4 key购买 nike

Error: [vite]: Rollup failed to resolve import "@/sample.js" from"src/routes/random.svelte". This is most likely unintended because itcan break your application at runtime. If you do want to externalizethis module explicitly add it to build.rollupOptions.external

查看配置:

 plugins: [atomicPlugin(allAtomicCSSPaths)],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
fs: {
allow: [".."],
},
},

最佳答案

您可以通过以下方式解决此问题:

plugins: [atomicPlugin(allAtomicCSSPaths)],
resolve: {
alias: [{ find: "@", replacement: "/src" }],
},
server: {
fs: {
allow: [".."],
},
},

更多可以看完整的问题讨论: https://github.com/vitejs/vite/issues/279

关于svelte - Rollup 无法解析 vite 中的 alias(@),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71203455/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com