diff --git a/README.md b/README.md index ebff6f6..383014c 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,14 @@ Vue.use(borderBox1) [UMD版使用示例](./umdExample.html) +### 使用Vite + +* 安装以下依赖,并将```vite.config.js```复制至项目目录即可。 + +```bash +npm install @vitejs/plugin-vue2 less -D +``` + ### TODO * **地图组件** diff --git a/README_EN.md b/README_EN.md index 7289581..ad45308 100644 --- a/README_EN.md +++ b/README_EN.md @@ -47,6 +47,14 @@ The `UMD` version can be directly imported using the `script` tag. The `UMD` ver [UMD version usage example](./umdExample.html) +### Use Vite + +* Install below dependencies and take the ```vite.config.js``` to you project directory just done. + +```bash +npm install @vitejs/plugin-vue2 less -D +``` + ### React version The reaction version is already under development, so stay tuned diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..9821b1c --- /dev/null +++ b/vite.config.js @@ -0,0 +1,21 @@ +import {defineConfig} from 'vite'; +import vue from '@vitejs/plugin-vue2' + +// https://vitejs.dev/config +export default defineConfig({ + resolve: { + alias: [ + { + find: /@jiaminghi\/.+/, replacement: path => { + path = path.replace('lib', 'src') + if (/^[^/]+$/.test(path)) + path = `${path}/src` + else if (/\.css$/.test(path)) + path = path.replace('src/components', 'lib/components') + return path + } + }, + ] + }, + plugins: [vue()], +});