github vuejs/composition-api v1.3.0

latest releases: v1.7.2, v1.7.1, v1.7.0...
3 years ago

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

vueuse/vueuse#718

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

vueuse/vue-demi#106 (comment)

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'
  ]
}

Bug Fixes

Don't miss a new composition-api release

NewReleases is sending notifications on new releases.