Skip to content

Commit

Permalink
fix: transpile @vue/composition-api (#391)
Browse files Browse the repository at this point in the history
* means @nuxtjs/composition-api can truly be in `devDependencies`
  • Loading branch information
danielroe authored Mar 5, 2021
1 parent e47805d commit 7e6334f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 36 deletions.
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ const compositionApiModule: Module<any> = function compositionApiModule() {
this.options.build.transpile = this.options.build.transpile || []
this.options.build.transpile.push('@nuxtjs/composition-api')

if (!this.nuxt.options.dev) {
this.options.build.transpile.push('@vue/composition-api')
}

// Fake alias to prevent shadowing actual node_module
this.options.alias['@nuxtjs/composition-api'] = entryFile

Expand Down
36 changes: 0 additions & 36 deletions test/unit/ssr-ref.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,6 @@
import { ssrRef, globalPlugin } from '../../lib/entrypoint'
import * as cAPI from '@vue/composition-api'

jest.setTimeout(60000)

import { setup, get } from '@nuxtjs/module-test-utils'
import config from '../fixture/nuxt.config'

let nuxt

describe('ssrRef', () => {
beforeAll(async () => {
nuxt = (await setup(config)).nuxt
}, 60000)

afterAll(async () => {
await nuxt.close()
})

test('__NUXT__ contains correct data', async () => {
const homePage = await get('/')
expect(homePage.includes('"only SSR rendered"')).toBeFalsy()
expect(homePage.includes('"runs SSR or client-side"')).toBeFalsy()

const ssrRefPage = await get('/ssr-ref')
expect(ssrRefPage).toContain('"only SSR rendered"')
expect(ssrRefPage).toContain('"runs SSR or client-side"')

const noSetupPage = await get('/no-setup')
expect(noSetupPage).toContain('"prefetched async"')
expect(noSetupPage).toContain('"SSR overwritten"')
expect(noSetupPage.includes('"unchanged"')).toBeFalsy()

const rerenderedHomePage = await get('/')
expect(rerenderedHomePage.includes('"only SSR rendered"')).toBeFalsy()
expect(rerenderedHomePage.includes('"runs SSR or client-side"')).toBeFalsy()
})
})

describe('ssrRef reactivity', () => {
let ssrContext: Record<string, any>

Expand Down

1 comment on commit 7e6334f

@vercel
Copy link

@vercel vercel bot commented on 7e6334f Mar 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.