Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.4k views
in Technique[技术] by (71.8m points)

vite 动态导入怎么配置?

image.png

image.png

如图,使用动态导入的语法,在dev模式下会有个忽略警告,但是能正常运行,

build模式下会报错找不到模块

image.png

请问有人知道嘛


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

动态导入在生产环境下的错误警告只需在动态导入的时候增加一段注释即可

import(/* @vite-ignore */`/@/${componentPath}`)

但是打包后依旧找不到模块,问题出在哪里我还在看尤大神的回复....


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...