Skip to content

Commit a3f3cdb

Browse files
committed
wip: vite 2.0 support
1 parent 957b956 commit a3f3cdb

File tree

13 files changed

+747
-1665
lines changed

13 files changed

+747
-1665
lines changed

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ Add it to `vite.config.js`
3030

3131
```ts
3232
// vite.config.js
33+
import Vue from '@vitejs/plugin-vue'
3334
import ViteComponents from 'vite-plugin-components'
3435

3536
export default {
3637
plugins: [
38+
Vue(),
3739
ViteComponents()
3840
],
3941
};
@@ -99,12 +101,6 @@ ViteComponents({
99101
// Subdirectory paths for ignoring namespace prefixes
100102
// works when `directoryAsNamespace: true`
101103
globalNamespaces: [],
102-
103-
// vite config
104-
// currently, vite does not provide an API for plugins to get the config https://github.com/vitejs/vite/issues/738
105-
// you will need to pass `alias` and `root` if you set them in vite config
106-
alias: {},
107-
root: process.cwd(),
108104
})
109105
```
110106

example/package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77
"build": "cross-env DEBUG=vite-plugin-components:* vite build"
88
},
99
"dependencies": {
10-
"vue": "^3.0.3",
11-
"vant": "^3.0.1"
10+
"vant": "^3.0.2",
11+
"vue": "^3.0.5"
1212
},
1313
"devDependencies": {
14-
"@vue/compiler-sfc": "^3.0.3",
15-
"cross-env": "^7.0.2",
16-
"typescript": "^4.1.2",
17-
"vite": "^1.0.0-rc.13",
14+
"@vitejs/plugin-vue": "^1.0.3",
15+
"@vue/compiler-sfc": "^3.0.5",
16+
"cross-env": "^7.0.3",
17+
"typescript": "^4.1.3",
18+
"vite": "^2.0.0-beta.2",
1819
"vite-plugin-components": "workspace:*",
19-
"vite-plugin-md": "^0.1.2"
20+
"vite-plugin-md": "^0.1.5"
2021
}
2122
}

example/vite.config.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
import path from 'path'
22
import { UserConfig } from 'vite'
3+
import Vue from '@vitejs/plugin-vue'
34
import ViteComponents from 'vite-plugin-components'
4-
import Markdown from 'vite-plugin-md'
5-
6-
const alias = {
7-
'/~/': path.resolve(__dirname, 'src'),
8-
}
5+
// import Markdown from 'vite-plugin-md'
96

107
const config: UserConfig = {
118
alias: {
129
'/~/': path.resolve(__dirname, 'src'),
1310
},
1411
plugins: [
15-
Markdown(),
12+
Vue(),
13+
// Markdown(),
1614
ViteComponents({
17-
extensions: ['vue', 'md'],
18-
alias,
15+
// extensions: ['vue', 'md'],
1916
directoryAsNamespace: true,
2017
globalNamespaces: ['global'],
21-
customLoaderMatcher: ({ path }) => path.endsWith('.md'),
18+
customLoaderMatcher: path => path.endsWith('.md'),
2219
customComponentResolvers: [
2320
(name) => {
2421
if (name === 'MyCustom')

package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,25 @@
2121
"example:dev": "npm -C example run dev",
2222
"example:build": "npm -C example run build",
2323
"build": "tsup src/index.ts --dts --format cjs,esm",
24-
"prepare": "npm run build",
24+
"prepublishOnly": "npm run build",
2525
"release": "standard-version && npm publish && git push"
2626
},
2727
"dependencies": {
28-
"debug": "^4.3.1",
28+
"debug": "^4.3.2",
2929
"fast-glob": "^3.2.4",
3030
"minimatch": "^3.0.4"
3131
},
3232
"devDependencies": {
3333
"@antfu/eslint-config": "^0.4.3",
3434
"@types/debug": "^4.1.5",
3535
"@types/minimatch": "^3.0.3",
36-
"@typescript-eslint/eslint-plugin": "^4.8.2",
37-
"eslint": "^7.14.0",
38-
"rollup": "^2.33.3",
39-
"standard-version": "^9.0.0",
40-
"tsup": "^3.10.1",
41-
"typescript": "^4.1.2",
42-
"vite": "^1.0.0-rc.13"
36+
"@types/node": "^14.14.19",
37+
"@typescript-eslint/eslint-plugin": "^4.11.1",
38+
"eslint": "^7.17.0",
39+
"rollup": "^2.35.1",
40+
"standard-version": "^9.1.0",
41+
"tsup": "^3.11.0",
42+
"typescript": "^4.1.3",
43+
"vite": "^2.0.0-beta.2"
4344
}
4445
}

0 commit comments

Comments
 (0)