fix(vite): add missing import.meta functions (#1513)

This commit is contained in:
Anthony Fu 2021-10-27 19:32:26 +08:00 committed by GitHub
parent 00e25fa8e8
commit cf99fd2862
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,7 +149,8 @@ async function __instantiateModule__(url, urlStack) {
const stubModule = { [Symbol.toStringTag]: 'Module' }
Object.defineProperty(stubModule, '__esModule', { value: true })
mod.stubModule = stubModule
const importMeta = { url, hot: { accept() {} } }
// https://vitejs.dev/guide/api-hmr.html
const importMeta = { url, hot: { accept() {}, prune() {}, dispose() {}, invalidate() {}, decline() {}, on() {} } }
urlStack = urlStack.concat(url)
const isCircular = url => urlStack.includes(url)
const pendingDeps = []