Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

feat: experimental vite support #387

Merged
merged 21 commits into from
Mar 5, 2021
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,17 @@ const compositionApiModule: Module<any> = function compositionApiModule() {
},
})

const entryFile = resolve(this.options.buildDir || '', entryDst)

this.options.build.transpile = this.options.build.transpile || []
this.options.build.transpile.push(/@nuxtjs[\\/]composition-api/)
danielroe marked this conversation as resolved.
Show resolved Hide resolved
this.options.build.transpile.push(entryFile)

// Fake alias to prevent shadowing actual node_module
const aliases = ['@nuxtjs/composition-api', '@nuxtjs/vite-composition-api']

for (const alias of aliases) {
this.options.alias[alias] = resolve(this.options.buildDir || '', entryDst)
this.options.alias[alias] = entryFile
}

this.nuxt.hook('vite:extend', (ctx: any) => {
Expand All @@ -121,9 +127,6 @@ const compositionApiModule: Module<any> = function compositionApiModule() {
this.options.build.babel.plugins.push(join(__dirname, 'babel'))
}

this.options.build.transpile = this.options.build.transpile || []
this.options.build.transpile.push(/@nuxtjs[\\/]composition-api/)

const actualPresets = this.options.build.babel.presets

this.options.build.babel.presets = (
Expand Down