vueuse/vue-demi

about 2.7 exports Vue.util.warn

Ariesly opened this issue · 2 comments

Why v2.7 need exports warn
And v2 and v3 do not need?
Is it necessary? Can we remove it

lib/v2.7/index.cjs
lib/v2.7/index.d.ts
lib/v2.7/index.mjs

> vite build

failed to load config from /workspaces/vue-demi-component-template/vue2.7-playground/vite.config.ts
error during build:
TypeError: Cannot read properties of undefined (reading 'warn')
    at Object.<anonymous> (/workspaces/vue-demi-component-template/node_modules/.pnpm/vue-demi@0.14.5_@vue+composition-api@1.7.1_vue@3.2.47/node_modules/vue-demi/lib/index.cjs:11:25)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
    at _require.extensions.<computed> [as .js] (file:///workspaces/vue-demi-component-template/node_modules/.pnpm/vite@4.2.1_@types+node@18.11.18/node_modules/vite/dist/node/chunks/dep-79892de8.js:63989:17)
    at Module.load (node:internal/modules/cjs/loader:1133:32)
    at Module._load (node:internal/modules/cjs/loader:972:12)
    at Module.require (node:internal/modules/cjs/loader:1157:19)
    at require (node:internal/modules/helpers:119:18)
    at Object.<anonymous> (/workspaces/vue-demi-component-template/vue2.7-playground/vite.config.ts:43:23)
    at Module._compile (node:internal/modules/cjs/loader:1275:14)

Reproduction:
https://github.com/Ariesly/vue-demi-component-template

pnpm install

pnpm build:2.7

Please check if your package is correct, as it seems to be running fine on my end.

Please check if your package is correct, as it seems to be running fine on my end.

Yes, it's a package problem, and it's solved by adding vue2.7 to the npm alias

...
"scripts": {
...
"build:2.7": "vue-demi-switch 2.7 vue2.7 && ..."
...
},
...
"devDependencies": {
...
"vue2.7": "npm:vue@2.7",
...
}