Wrong wite NuxtJs(3.0.0 RC1)
See original GitHub issueThis function solves the problem (这个功能解决的问题)
各种方式引入nuxtjs(3.0.0 RC1)失败,全局,按需,手动,都报各种错误,导致vite预建模块速度极慢,然后报错,这是手动引入的一个错误:
(node:13776) Warning: To load an ES module, set “type”: “module” in the package.json or use the .mjs extension.
(Use node --trace-warnings ...
to show where the warning was created)
D:\NodeJsWS\my-nuxt3-app\node_modules\vueuc\es\shared\finweck-tree.js:4
export class FinweckTree {
^^^^^^
SyntaxError: Unexpected token ‘export’ at Object.compileFunction (node:vm:352:18) at wrapSafe (node:internal/modules/cjs/loader:1032:15) at Module._compile (node:internal/modules/cjs/loader:1067:27) at Object.Module._extensions…js (node:internal/modules/cjs/loader:1155:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:168:29) at ModuleJob.run (node:internal/modules/esm/module_job:195:25) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
Expected API (期望的 API)
适配nuxtjs(3.0.0 RC1)的按需引入方式。
Issue Analytics
- State:
- Created a year ago
- Comments:13 (1 by maintainers)
vueuc@0.4.32
引入@juggle/resize-observer
ESM问题导致的参考
nuxt3
官方文档ES Modules在
transpile
中额外加入@juggle/resize-observer
It works now.
See https://www.naiveui.com/en-US/os-theme/docs/ssr