Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaochenchen-igg-com committed Apr 4, 2022
1 parent 6ff8ceb commit d1e46ff
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

[![NPM version](https://img.shields.io/npm/v/vite-plugin-dynamic-base?color=a1b858&label=)](https://www.npmjs.com/package/vite-plugin-dynamic-base)

<p align='center'>
<b>English</b> | <a href="https://github.com/chenxch/vite-plugin-dynamic-base/blob/main/README.zh-CN.md">简体中文</a>
</p>

- 🦾 Resolve all resource files dynamic publicPath, like Webpack's `__webpack_public_path__`.

## Installation
Expand Down
49 changes: 49 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# vite-plugin-dynamic-base

[![NPM version](https://img.shields.io/npm/v/vite-plugin-dynamic-base?color=a1b858&label=)](https://www.
npmjs.com/package/vite-plugin-dynamic-base)

<a href="https://github.com/chenxch/vite-plugin-dynamic-base/blob/main/README.md">English</a> | <b>简体中文</b>
</p>

- 🦾 解析所有资源文件动态路径(多cdn切换), 类似 Webpack 的 `__webpack_public_path__`.

## 安装

```bash
npm i vite-plugin-dynamic-base -D
```
## 编译模式

- [x] es
- [x] system

## 使用

```ts
// vite.config.ts
import { dynamicBase } from 'vite-plugin-dynamic-base'

export default defineConfig({
plugins: [
dynamicBase({ /* options */ }),
],
})
```

## 配置

以下显示配置的默认值

```ts
dynamicBase({
// dynamic public path var string, default window.__dynamic_base__
publicPath: 'window.__dynamic_base__',
// dynamic load resources on index.html, default false. maybe change default true
transformIndexHtml: false
})
```

## 计划

1. 探索利用SWC改造AST进行加工的可行性

0 comments on commit d1e46ff

Please sign in to comment.