Skip to content

Commit 05196ec

Browse files
authoredDec 25, 2022
feat: support nuxt@3.0.0 (#569)
1 parent a6e700c commit 05196ec

File tree

3 files changed

+2957
-1813
lines changed

3 files changed

+2957
-1813
lines changed
 

‎package.json

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
},
8686
"dependencies": {
8787
"@antfu/utils": "^0.7.2",
88+
"@nuxt/kit": "^3.0.0",
8889
"@rollup/pluginutils": "^5.0.2",
8990
"chokidar": "^3.5.3",
9091
"debug": "^4.3.4",
@@ -99,6 +100,7 @@
99100
"@antfu/eslint-config": "^0.33.1",
100101
"@babel/parser": "^7.20.5",
101102
"@babel/types": "^7.20.5",
103+
"@nuxt/schema": "^3.0.0",
102104
"@types/debug": "^4.1.7",
103105
"@types/minimatch": "^5.1.2",
104106
"@types/node": "^18.11.13",

‎pnpm-lock.yaml

+2,945-1,800
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/nuxt.ts

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1+
import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from '@nuxt/kit'
2+
// Workaround for:
3+
// src/nuxt.ts(5,1): error TS2742: The inferred type of 'default' cannot be named without a reference to '.pnpm/@nuxt+schema@3.0.0_rollup@2.79.0/node_modules/@nuxt/schema'. This is likely not portable. A type annotation is necessary.
4+
import type { } from '@nuxt/schema'
15
import type { Options } from './types'
26
import unplugin from '.'
37

4-
export default function (this: any, options: Options) {
5-
// install webpack plugin
6-
this.extendBuild((config: any) => {
7-
config.plugins = config.plugins || []
8-
config.plugins.unshift(unplugin.webpack(options))
9-
})
10-
11-
// install vite plugin
12-
this.nuxt.hook('vite:extend', async (vite: any) => {
13-
vite.config.plugins = vite.config.plugins || []
14-
vite.config.plugins.push(unplugin.vite(options))
15-
})
16-
}
8+
export default defineNuxtModule({
9+
setup(options: Options) {
10+
addWebpackPlugin(unplugin.webpack(options))
11+
addVitePlugin(unplugin.vite(options))
12+
},
13+
})

0 commit comments

Comments
 (0)
Please sign in to comment.