Error

The above dynamic import cannot be analyzed by Vite. See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import()

Solution

When your import dynamic module in vite project, this error shows up. Just use the Glob to import your module. https://link.juejin.cn/?target=https%3A%2F%2Fcn.vitejs.dev%2Fguide%2Ffeatures.html%23glob-import