-
-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v0.12.0 import mjs issue #106
Comments
solution: #105 (comment) |
Current workaround for me is // package.json
// ...
"resolutions": {
"vue-demi": "0.11.4"
}
// ... |
You better set the alias for future-proofing:
|
Getting this error: [vite:load-fallback] Could not load @vue/composition-api/dist/vue-composition-api.mjs/dist/vue-composition-api.mjs (imported by node_modules/vue-demi/lib/index.mjs): ENOENT: no such file or directory, open '@vue/composition-api/dist/vue-composition-api.mjs/dist/vue-composition-api.mjs'
error during build:
Error: Could not load @vue/composition-api/dist/vue-composition-api.mjs/dist/vue-composition-api.mjs (imported by node_modules/vue-demi/lib/index.mjs): ENOENT: no such file or directory, open '@vue/composition-api/dist/vue-composition-api.mjs/dist/vue-composition-api.mjs' My import { resolve } from 'path';
import { defineConfig } from 'vite';
import tsNameof from 'vite-plugin-ts-nameof';
import { createVuePlugin } from 'vite-plugin-vue2';
// https://vitejs.dev/config
export default defineConfig({
plugins: [
tsNameof(),
createVuePlugin()
],
resolve: {
alias: {
'@': resolve(__dirname, './src'),
// https://github.com/vueuse/vue-demi/issues/106#issuecomment-953155139
'@vue/composition-api': '@vue/composition-api/dist/vue-composition-api.mjs',
'@vue/composition-api/dist/vue-composition-api.esm.js': '@vue/composition-api/dist/vue-composition-api.mjs'
}
},
build: {
assetsDir: 'static',
target: ['chrome63'],
chunkSizeWarningLimit: 2048
},
server: {
port: 18080
}
}); Using |
Because of Try to use regexp alias: [
{ find: /^@vue\/composition-api$/, replacement: '@vue/composition-api/dist/vue-composition-api.mjs' },
] |
@sxzz Thank you, that works: resolve: {
alias: [
{ find: '@', replacement: resolve(__dirname, './src') },
{ find: /^@vue\/composition-api$/, replacement: '@vue/composition-api/dist/vue-composition-api.mjs' }
]
} |
Fixed in #105 |
Now in |
Can confirm it works 🎉 |
@antfu, I think it would be a good idea to update @vue/composition-api peer-dependency range to be "^1.3.0". This way you should get a warning when using a non mjs-ready @vue/composition-api version. |
I upgrade
@vue/composition-api
from1.1.5
to1.2.4
, and it emit error.I checked it babel jsx plugin imported
@vue/composition-api/dist/vue-composition-api.mjs
, butvue-demi
imported@vue/composition-api/dist/vue-composition-api.esm.js
.So I think it should be changed to
.mjs
as well.https://github.com/vuejs/composition-api/blob/a5a68e0e35321bf9d508c0a3046560112579de9b/package.json#L20
vue-demi/lib/v2/index.mjs
Line 2 in 077cdb8
The text was updated successfully, but these errors were encountered: