[Solved] Vue3 vite Error: Uncaught ReferenceError: require is not defined

when using vue3 + vite to build the background framework template, errors will be reported in vite according to some previous writing methods.

Require. In vue3 vite Context error

in vue2, use require Context to get all the files of a file, but an error is reported after using vite in vue3.

you need to use import meta.globEager("./modules/*.js")

process. env. XXXX related variable error

in vue2, use process env.XXXX to get environment variables

use iimport meta.env.XXXX solution

problems in subsequent construction shall be updated gradually

Similar Posts: