composition-api
composition-api copied to clipboard
bug: useAsync don't work in SSR
🐛 The bug useAsync in nuxt-composition-api don't work with SSR
🛠️ To reproduce Steps to reproduce the behavior:
- set babel in nuxt.config.ts
babel: {
presets({ isServer }) {
const targets = isServer ? { node: 'current' } : { browsers: ['last 2 versions'], ie: 11 };
return [['@nuxt/babel-preset-app', { corejs: { version: 3 }, targets }]];
},
plugins: [['@babel/plugin-transform-runtime', { regenerator: true }]],
},
- create a page component
<script lang="ts">
import { defineComponent, useAsync } from '@nuxtjs/composition-api';
export default defineComponent({
name: 'LiveDashboard',
setup() {
useAsync(() => {
console.log('useAsync');
});
return {};
},
});
</script>
- See error
