godky
godky
**cjs和esm混用导致的**。配置alias之后,vue指向了用一个源。如果不配置alias,则按照nodejs默认规则解析,element-ui/lib内使用的vue是`vue/dist/dist/vue.runtime.common.js`,而源码中 `import Vue from vue` 指向了 `vue/dist/vue.runtime.esm.js`,从而使用的不是同一个Vue构造函数。在vite中经过了 `esbuild` 或 `@rollup/plugin-commonjs` 转换,cjs导入变成了esm导入,所以表现正常。结合以上分析,把入口`import Vue from vue` 改`const Vue = require('vue')`之后,即使不配置alias的情况下,同样会表现正常。
> 这个问题更合适的修复方式是使用 Vant 里的 useVisibilityChange 方法,不过这个方法依赖 IntersectionObserver,存在兼容性问题 嗯,确实
@thecodrr The feature '[AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController#browser_compatibility)' used in this [commit](https://github.com/thecodrr/fdir/commit/2f6145e6a8ae78dcc64f529512f33f291226f3ea#diff-df87aa1bb6a1c46e6f011a574dfe5a0c583f4fa33925dfac677cd0d76742b5f6R51) breaks compatibility with Node 12. Is this what we expected?
> Er, well, no, given the package still doesn't declare which node versions it actually supports, and therefore it's assumed that it supports all of them. > > The "right"...
> we should probably raise an issue on fdir, since i'm pretty sure they want to remain compatible with node12. i'll merge this if they don't want to keep node12...
> @godky considering fdir hasn't removed their usage of `AbortController` and it's been two weeks (with no one reporting any issues) i might merge this. were you affected by fdir...
> Thank you so much for including updated test cases in this PR! > > Using `new URL` needs a guard for malformed urls as it can throw an exception...