From cf5bcdc00fc62b9d7702056095922038fafd3502 Mon Sep 17 00:00:00 2001 From: Octoape Date: Wed, 21 Aug 2024 18:26:04 +0800 Subject: [PATCH] Fix VSCode warning --- example/test-vite.config.ts | 6 +++--- example/vite.config.ts | 4 ++-- example2/tsconfig.json | 3 +-- example2/tsconfig.node.json | 10 ---------- example2/vite.config.ts | 17 ++++++++--------- package.json | 2 +- 6 files changed, 15 insertions(+), 27 deletions(-) delete mode 100644 example2/tsconfig.node.json diff --git a/example/test-vite.config.ts b/example/test-vite.config.ts index 541f964..9856d8b 100644 --- a/example/test-vite.config.ts +++ b/example/test-vite.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from 'vite' +import { defineConfig, Plugin } from 'vite' import vue from '@vitejs/plugin-vue' import bodyParser from 'body-parser' import cookieParser from 'cookie-parser' @@ -19,7 +19,7 @@ export default defineConfig({ bodyParser.text(), bodyParser.raw() ] - }), + }) as Plugin, { name: `vite-plugin-stop`, apply: 'serve', @@ -37,7 +37,7 @@ export default defineConfig({ if(responseText !== 'Hello world!/api/test1/1' || userId !== "octoape") throw new Error('wrong mock response') else - console.log('\x1b[32m ✓ correct mock response \x1b[0m'); + console.log('\x1b[32m ✓ correct mock response \x1b[0m'); setTimeout(process.exit, 1e3) } diff --git a/example/vite.config.ts b/example/vite.config.ts index 3f0fe4c..2ba81ec 100644 --- a/example/vite.config.ts +++ b/example/vite.config.ts @@ -1,4 +1,4 @@ -import { defineConfig } from 'vite' +import { defineConfig, Plugin } from 'vite' import vue from '@vitejs/plugin-vue' import bodyParser from 'body-parser' import cookieParser from 'cookie-parser' @@ -17,6 +17,6 @@ export default defineConfig({ bodyParser.text(), bodyParser.raw() ] - }) + }) as Plugin ] }) diff --git a/example2/tsconfig.json b/example2/tsconfig.json index 9e03e60..0b8e08b 100644 --- a/example2/tsconfig.json +++ b/example2/tsconfig.json @@ -20,6 +20,5 @@ "noUnusedParameters": true, "noFallthroughCasesInSwitch": true }, - "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"], - "references": [{ "path": "./tsconfig.node.json" }] + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"] } diff --git a/example2/tsconfig.node.json b/example2/tsconfig.node.json deleted file mode 100644 index 42872c5..0000000 --- a/example2/tsconfig.node.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "compilerOptions": { - "composite": true, - "skipLibCheck": true, - "module": "ESNext", - "moduleResolution": "bundler", - "allowSyntheticDefaultImports": true - }, - "include": ["vite.config.ts"] -} diff --git a/example2/vite.config.ts b/example2/vite.config.ts index 33fde5a..fb54ac4 100644 --- a/example2/vite.config.ts +++ b/example2/vite.config.ts @@ -1,20 +1,17 @@ -import { ConfigEnv, defineConfig, Plugin, UserConfigExport } from 'vite' +import { ConfigEnv, Plugin, UserConfigExport } from 'vite' import vue from '@vitejs/plugin-vue' import fetch from 'node-fetch' -//import mockServer from 'vite-plugin-mock-server' -//import mockServer from '../dist' import mockServer from '../src' const port = 8000 export default ({ command, mode }: ConfigEnv): UserConfigExport => { - - if(mode !== 'test') + if(mode !== 'test') { return { plugins: [ vue(), - mockServer() + mockServer() as Plugin ]} - else + } else { // auto close after 5 secounds, to the runtime return { server: { @@ -22,7 +19,7 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => { }, plugins: [ vue(), - mockServer(), + mockServer() as Plugin, { name: `vite-plugin-stop`, apply: 'serve', @@ -41,5 +38,7 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => { , 5000) } } - ]} + ] + } + } } diff --git a/package.json b/package.json index c51ee89..16c8707 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vite-plugin-mock-server", - "version": "1.3.0", + "version": "1.3.1", "description": "Vite mock server plugin", "main": "dist/index.js", "scripts": {