Menci / vite-plugin-top-level-await

Transform code to support top-level await in normal browsers for Vite.
MIT License
273 stars 15 forks source link

import.meta -> import_meta #48

Open LomyCool opened 7 months ago

LomyCool commented 7 months ago
image

With the vite-plugin-federation library, build the version and find that "import.meta" is converted to "import_meta"

配合使用 vite-plugin-federation 库,构建版本,发现 “import.meta” 被转换成 “ import_meta”

LomyCool commented 7 months ago

image After source code debugging, it was found that it was caused by the buildRawTarget function 经过源码调试,发现是buildRawTarget函数导致的

Menci commented 4 months ago

你原本项目的 Vite target 是什么?我的原理是首先以 esnext 编译然后转译,很可能是做了一些 transpile 变成这样的。这里 import_meta 看起来像是上面有一个 const import_meta = import_meta_available ? import.meta : some_polyfill 之类的东西?

Menci commented 4 months ago

能提供一个复现吗