v1.3.0
Notable Changes
The module
field now points to the .mjs
version build instead of .esm.js
for better native ESM support and future-proofing.
Troubleshooting
.mjs
can't resolve on Webpack 4
Nuxt
// nuxt.config.js
module.exports = {
build: {
extend (config) {
config.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
})
}
}
}
Vue CLI
// vue.config.js
module.exports = {
configureWebpack: {
module: {
rules: [{
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
}]
}
}
}
[vue-composition-api] must call Vue.use(VueCompositionAPI) before using any function
Make share you have only one version of @vue/composition-api
installed and resolved to the same version.
Vite
resolve: {
alias: [
{ find: /^@vue\/composition-api$/, replacement: '@vue/composition-api/dist/vue-composition-api.mjs' },
]
}
Webpack
resolve: {
alias: [
'@vue/composition-api$': '@vue/composition-api/dist/vue-composition-api.mjs'
]
}