Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ee0592f

Browse files
fix: 修复打包出来的版本不支持vue2的问题
1 parent 5ef9afb commit ee0592f

File tree

11 files changed

+5534
-3106
lines changed

11 files changed

+5534
-3106
lines changed

‎.npmrc‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# shamefully-hoist = true
2+
# strict-peer-dependencies=true
3+
# legacy-peer-deps=true
4+
# dedupe-peer-dependents=false

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ npm install @wsfe/vue-tree
2828
直接引入 css
2929

3030
```less
31-
@import '~@wsfe/vue-tree/dist/style.css';
31+
@import '~@wsfe/vue-tree/style.css';
3232
```
3333

3434
引入 less 以便于变量覆盖
@@ -42,7 +42,7 @@ npm install @wsfe/vue-tree
4242
```typescript
4343
// 大家可以根据需要是否引入VTreeNode, VTreeSearch, VTreeDrop
4444
import Vtree, { VTreeNode, VTreeSearch, VTreeDrop } from '@wsfe/vue-tree'
45-
import '@wsfe/vue-tree/dist/style.css'
45+
import '@wsfe/vue-tree/style.css'
4646
```
4747

4848
# 接口文档

‎package.json‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,37 @@
11
{
22
"name": "@wsfe/vue-tree",
3-
"version": "3.0.3",
3+
"version": "3.0.6",
44
"types": "./types",
55
"description": "A vue tree component using virtual list.",
6-
"main": "./dist/vue-tree.umd.min.js",
7-
"module": "./dist/vue-tree.mjs",
6+
"main": "./dist/v3/vue-tree.umd.js",
7+
"module": "./dist/v3/vue-tree.mjs",
88
"exports": {
99
".": {
10-
"import": "./dist/vue-tree.mjs",
11-
"require": "./dist/vue-tree.umd.js"
10+
"import": "./dist/v3/vue-tree.mjs",
11+
"require": "./dist/v3/vue-tree.umd.js"
1212
},
13+
"./style.css": "./dist/v3/style.css",
1314
"./*": "./*"
1415
},
1516
"scripts": {
1617
"dev": "vite",
1718
"dts": "vue-tsc --declaration --emitDeclarationOnly",
18-
"build": "npm run dts && vite build",
19+
"build": "npm run dts && npm run build:2 && npm run build:3",
20+
"build:2": "pnpm --filter vue2 run build",
21+
"build:3": "vite build",
1922
"docs": "vue-tsc --noEmit && vite build -c examples/vite.config.ts",
2023
"preview": "vite preview",
2124
"test": "jest --watch",
22-
"prettier": "prettier --write \"{src,examples,tests}/**/*.{ts,js,json,vue,tsx,less,scss,less,html}\" --fix"
25+
"prettier": "prettier --write \"{src,examples,tests}/**/*.{ts,js,json,vue,tsx,less,scss,less,html}\" --fix",
26+
"postinstall": "node ./scripts/postinstall.cjs"
2327
},
2428
"publishConfig": {
2529
"registry": "https://registry.npmjs.org/",
2630
"access": "public"
2731
},
2832
"files": [
2933
"dist",
34+
"scripts",
3035
"src",
3136
"types"
3237
],
@@ -77,13 +82,9 @@
7782
"vue-jest": "5.0.0-alpha.10",
7883
"vue-tsc": "^1.0.24"
7984
},
80-
"peerDependencies": {
81-
"@vue/composition-api": "^1.0.0-rc.1",
82-
"vue": "^2.0.0 || >=3.0.0"
83-
},
8485
"peerDependenciesMeta": {
8586
"@vue/composition-api": {
8687
"optional": true
8788
}
8889
}
89-
}
90+
}

‎packages/vue2/package.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "vue2",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"build": "vite build"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"devDependencies": {
12+
"@vue/composition-api": "^1.7.1",
13+
"vite": "^4.1.1",
14+
"vite-plugin-vue2": "^2.0.3",
15+
"vue": "2.6.14",
16+
"vue-template-compiler": "2.6.14"
17+
}
18+
}

‎packages/vue2/vite.config.ts‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { defineConfig, UserConfig } from 'vite'
2+
// import vue2 from '@vitejs/plugin-vue2'
3+
import { createVuePlugin } from 'vite-plugin-vue2'
4+
import { resolve, join } from 'path'
5+
6+
// https://vitejs.dev/config/
7+
export default defineConfig((): UserConfig => {
8+
return {
9+
resolve: {
10+
alias: {
11+
'@': resolve('../../src')
12+
}
13+
},
14+
plugins: [createVuePlugin()],
15+
optimizeDeps: {
16+
exclude: ['vue-demi']
17+
},
18+
server: {
19+
open:true,
20+
hmr:true
21+
},
22+
build: {
23+
lib: {
24+
entry: resolve(__dirname,'../../src/index.ts'),
25+
name:'Vtree',
26+
fileName: 'vue-tree'
27+
},
28+
rollupOptions: {
29+
external: ['vue', 'vue-demi'],
30+
output: {
31+
dir: join(__dirname, '../../dist/v2'),
32+
exports: 'named',
33+
globals: {
34+
vue: 'Vue',
35+
'vue-demi': 'VueDemi'
36+
}
37+
}
38+
}
39+
}
40+
}
41+
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /