跳到主要内容

import()

2023年05月27日
柏拉文
越努力,越幸运

一、认识


Vite 也支持带变量的动态导入。

二、语法


2.1 静态路径导入

const module = await import("xxx");

2.2 动态路径导入

const module = await import(`xxx/${path}/xxx`);