Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k 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 Reply

0 votes
by (71.8m points)

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

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.6k users

...