mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 22:59:10 +00:00
chore: fix term cases (#7553)
This commit is contained in:
parent
315fd50be1
commit
c29613013c
@ -24,7 +24,7 @@ If you want to use break point and explore code execution you can use the ["Run
|
|||||||
|
|
||||||
2. Click on the "Run and Debug" icon in the activity bar of the editor.
|
2. Click on the "Run and Debug" icon in the activity bar of the editor.
|
||||||
|
|
||||||
3. Click on the "Javascript Debug Terminal" button.
|
3. Click on the "JavaScript Debug Terminal" button.
|
||||||
|
|
||||||
4. It will open a terminal, then go to `packages/playground/xxx` and run `pnpm run dev`.
|
4. It will open a terminal, then go to `packages/playground/xxx` and run `pnpm run dev`.
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ The english docs are embedded in the main Vite repo, to allow contributors to wo
|
|||||||
1. In order to get all doc files, you first need to clone this repo in your personal account.
|
1. In order to get all doc files, you first need to clone this repo in your personal account.
|
||||||
2. Keep all the files in `docs/` and remove everything else.
|
2. Keep all the files in `docs/` and remove everything else.
|
||||||
|
|
||||||
- You should setup your translation site based on all the files in `docs/` folder as a Vitepress project.
|
- You should setup your translation site based on all the files in `docs/` folder as a VitePress project.
|
||||||
(that said, `package.json` is need).
|
(that said, `package.json` is need).
|
||||||
|
|
||||||
- Refresh git history by removing `.git` and then `git init`
|
- Refresh git history by removing `.git` and then `git init`
|
||||||
@ -238,7 +238,7 @@ The english docs are embedded in the main Vite repo, to allow contributors to wo
|
|||||||
|
|
||||||
- During this stage, you may be translating documents and synchronizing updates at the same time, but don't worry about that, it's very common in translation contribution.
|
- During this stage, you may be translating documents and synchronizing updates at the same time, but don't worry about that, it's very common in translation contribution.
|
||||||
|
|
||||||
4. Push your commits to your Github repo. you can setup a netlify preview as well.
|
4. Push your commits to your GitHub repo. you can setup a netlify preview as well.
|
||||||
5. Use [Ryu-cho](https://github.com/vuejs-translations/ryu-cho) tool to setup a Github Action, automatically track English docs update later.
|
5. Use [Ryu-cho](https://github.com/vuejs-translations/ryu-cho) tool to setup a GitHub Action, automatically track English docs update later.
|
||||||
|
|
||||||
We recommend talking with others in Vite Land so you find more contributors for your language to share the maintenance work. Once the translation is done, communicate it to the Vite team so the repo can be moved to the official vitejs org in GitHub.
|
We recommend talking with others in Vite Land so you find more contributors for your language to share the maintenance work. Once the translation is done, communicate it to the Vite team so the repo can be moved to the official vitejs org in GitHub.
|
||||||
|
@ -34,7 +34,7 @@ The [programmatic API](https://vitejs.dev/guide/api-javascript.html) has also be
|
|||||||
|
|
||||||
### esbuild Powered Dep Pre-Bundling
|
### esbuild Powered Dep Pre-Bundling
|
||||||
|
|
||||||
Since Vite is a native ESM dev server, it pre-bundles dependencies to reduce the number browser requests and handle CommonJS to ESM conversion. Previously Vite did this using Rollup, and in 2.0 it now uses `esbuild` which results in 10-100x faster dependency pre-bundling. As a reference, cold-booting a test app with heavy dependencies like React Material UI previously took 28 seconds on an M1-powered Macbook Pro and now takes ~1.5 seconds. Expect similar improvements if you are switching from a traditional bundler based setup.
|
Since Vite is a native ESM dev server, it pre-bundles dependencies to reduce the number browser requests and handle CommonJS to ESM conversion. Previously Vite did this using Rollup, and in 2.0 it now uses `esbuild` which results in 10-100x faster dependency pre-bundling. As a reference, cold-booting a test app with heavy dependencies like React Material UI previously took 28 seconds on an M1-powered MacBook Pro and now takes ~1.5 seconds. Expect similar improvements if you are switching from a traditional bundler based setup.
|
||||||
|
|
||||||
### First-class CSS Support
|
### First-class CSS Support
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
|
|
||||||
- **Type:** `ESBuildOptions | false`
|
- **Type:** `ESBuildOptions | false`
|
||||||
|
|
||||||
`ESBuildOptions` extends [ESbuild's own transform options](https://esbuild.github.io/api/#transform-api). The most common use case is customizing JSX:
|
`ESBuildOptions` extends [esbuild's own transform options](https://esbuild.github.io/api/#transform-api). The most common use case is customizing JSX:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
@ -368,9 +368,9 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
By default, ESBuild is applied to `ts`, `jsx` and `tsx` files. You can customize this with `esbuild.include` and `esbuild.exclude`, which can be a regex, a [picomatch](https://github.com/micromatch/picomatch#globbing-features) pattern, or an array of either.
|
By default, esbuild is applied to `ts`, `jsx` and `tsx` files. You can customize this with `esbuild.include` and `esbuild.exclude`, which can be a regex, a [picomatch](https://github.com/micromatch/picomatch#globbing-features) pattern, or an array of either.
|
||||||
|
|
||||||
In addition, you can also use `esbuild.jsxInject` to automatically inject JSX helper imports for every file transformed by ESBuild:
|
In addition, you can also use `esbuild.jsxInject` to automatically inject JSX helper imports for every file transformed by esbuild:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
@ -380,7 +380,7 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
Set to `false` to disable ESbuild transforms.
|
Set to `false` to disable esbuild transforms.
|
||||||
|
|
||||||
### assetsInclude
|
### assetsInclude
|
||||||
|
|
||||||
@ -849,7 +849,7 @@ export default defineConfig({
|
|||||||
- **Type:** `boolean | 'terser' | 'esbuild'`
|
- **Type:** `boolean | 'terser' | 'esbuild'`
|
||||||
- **Default:** `'esbuild'`
|
- **Default:** `'esbuild'`
|
||||||
|
|
||||||
Set to `false` to disable minification, or specify the minifier to use. The default is [Esbuild](https://github.com/evanw/esbuild) which is 20 ~ 40x faster than terser and only 1 ~ 2% worse compression. [Benchmarks](https://github.com/privatenumber/minification-benchmarks)
|
Set to `false` to disable minification, or specify the minifier to use. The default is [esbuild](https://github.com/evanw/esbuild) which is 20 ~ 40x faster than terser and only 1 ~ 2% worse compression. [Benchmarks](https://github.com/privatenumber/minification-benchmarks)
|
||||||
|
|
||||||
Note the `build.minify` option is not available when using the `'es'` format in lib mode.
|
Note the `build.minify` option is not available when using the `'es'` format in lib mode.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# JavaScript API
|
# JavaScript API
|
||||||
|
|
||||||
Vite's JavaScript APIs are fully typed, and it's recommended to use TypeScript or enable JS type checking in VSCode to leverage the intellisense and validation.
|
Vite's JavaScript APIs are fully typed, and it's recommended to use TypeScript or enable JS type checking in VS Code to leverage the intellisense and validation.
|
||||||
|
|
||||||
## `createServer`
|
## `createServer`
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ Vercel CLI
|
|||||||
|
|
||||||
### Vercel for Git
|
### Vercel for Git
|
||||||
|
|
||||||
1. Push your code to your git repository (GitHub, GitLab, BitBucket).
|
1. Push your code to your git repository (GitHub, GitLab, Bitbucket).
|
||||||
2. [Import your Vite project](https://vercel.com/new) into Vercel.
|
2. [Import your Vite project](https://vercel.com/new) into Vercel.
|
||||||
3. Vercel will detect that you are using Vite and will enable the correct settings for your deployment.
|
3. Vercel will detect that you are using Vite and will enable the correct settings for your deployment.
|
||||||
4. Your application is deployed! (e.g. [vite-vue-template.vercel.app](https://vite-vue-template.vercel.app/))
|
4. Your application is deployed! (e.g. [vite-vue-template.vercel.app](https://vite-vue-template.vercel.app/))
|
||||||
|
@ -18,7 +18,7 @@ Vite improves the dev server start time by first dividing the modules in an appl
|
|||||||
|
|
||||||
- **Dependencies** are mostly plain JavaScript that do not change often during development. Some large dependencies (e.g. component libraries with hundreds of modules) are also quite expensive to process. Dependencies may also be shipped in various module formats (e.g. ESM or CommonJS).
|
- **Dependencies** are mostly plain JavaScript that do not change often during development. Some large dependencies (e.g. component libraries with hundreds of modules) are also quite expensive to process. Dependencies may also be shipped in various module formats (e.g. ESM or CommonJS).
|
||||||
|
|
||||||
Vite [pre-bundles dependencies](./dep-pre-bundling) using [esbuild](https://esbuild.github.io/). Esbuild is written in Go and pre-bundles dependencies 10-100x faster than JavaScript-based bundlers.
|
Vite [pre-bundles dependencies](./dep-pre-bundling) using [esbuild](https://esbuild.github.io/). esbuild is written in Go and pre-bundles dependencies 10-100x faster than JavaScript-based bundlers.
|
||||||
|
|
||||||
- **Source code** often contains non-plain JavaScript that needs transforming (e.g. JSX, CSS or Vue/Svelte components), and will be edited very often. Also, not all source code needs to be loaded at the same time (e.g. with route-based code-splitting).
|
- **Source code** often contains non-plain JavaScript that needs transforming (e.g. JSX, CSS or Vue/Svelte components), and will be edited very often. Also, not all source code needs to be loaded at the same time (e.g. with route-based code-splitting).
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ This template should help get you started developing with Svelte and TypeScript
|
|||||||
|
|
||||||
## Recommended IDE Setup
|
## Recommended IDE Setup
|
||||||
|
|
||||||
[VSCode](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
|
[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
|
||||||
|
|
||||||
## Need an official Svelte framework?
|
## Need an official Svelte framework?
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ This template should help get you started developing with Svelte in Vite.
|
|||||||
|
|
||||||
## Recommended IDE Setup
|
## Recommended IDE Setup
|
||||||
|
|
||||||
[VSCode](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
|
[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
|
||||||
|
|
||||||
## Need an official Svelte framework?
|
## Need an official Svelte framework?
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
# Vue 3 + Typescript + Vite
|
# Vue 3 + TypeScript + Vite
|
||||||
|
|
||||||
This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
||||||
|
|
||||||
## Recommended IDE Setup
|
## Recommended IDE Setup
|
||||||
|
|
||||||
- [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
|
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
|
||||||
|
|
||||||
## Type Support For `.vue` Imports in TS
|
## Type Support For `.vue` Imports in TS
|
||||||
|
|
||||||
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
|
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
|
||||||
|
|
||||||
1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
|
1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
|
||||||
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
|
2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.
|
||||||
|
|
||||||
You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
|
You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
|
||||||
|
@ -11,7 +11,7 @@ const count = ref(0)
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Recommended IDE setup:
|
Recommended IDE setup:
|
||||||
<a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
|
<a href="https://code.visualstudio.com/" target="_blank">VS Code</a>
|
||||||
+
|
+
|
||||||
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
|
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
|
||||||
</p>
|
</p>
|
||||||
|
@ -4,4 +4,4 @@ This template should help get you started developing with Vue 3 in Vite. The tem
|
|||||||
|
|
||||||
## Recommended IDE Setup
|
## Recommended IDE Setup
|
||||||
|
|
||||||
- [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
|
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
|
||||||
|
@ -13,7 +13,7 @@ const count = ref(0)
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Recommended IDE setup:
|
Recommended IDE setup:
|
||||||
<a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
|
<a href="https://code.visualstudio.com/" target="_blank">VS Code</a>
|
||||||
+
|
+
|
||||||
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
|
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
|
||||||
</p>
|
</p>
|
||||||
|
@ -324,7 +324,7 @@ test('PostCSS dir-dependency', async () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Url separation', async () => {
|
test('URL separation', async () => {
|
||||||
const urlSeparated = await page.$('.url-separated')
|
const urlSeparated = await page.$('.url-separated')
|
||||||
const baseUrl = 'url(images/dog.webp)'
|
const baseUrl = 'url(images/dog.webp)'
|
||||||
const cases = new Array(5)
|
const cases = new Array(5)
|
||||||
|
@ -105,7 +105,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="url-separated">
|
<p class="url-separated">
|
||||||
Url separation preservation: should have valid background-image
|
URL separation preservation: should have valid background-image
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="inlined">Inlined import - this should NOT be red.</p>
|
<p class="inlined">Inlined import - this should NOT be red.</p>
|
||||||
|
@ -231,7 +231,7 @@ if (!isBuild) {
|
|||||||
await editFile('invalid.html', (content) => {
|
await editFile('invalid.html', (content) => {
|
||||||
return content.replace('<div Bad', '<div> Good')
|
return content.replace('<div Bad', '<div> Good')
|
||||||
})
|
})
|
||||||
const content = await page.waitForSelector('text=Good Html')
|
const content = await page.waitForSelector('text=Good HTML')
|
||||||
expect(content).toBeTruthy()
|
expect(content).toBeTruthy()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -1 +1 @@
|
|||||||
<div Bad Html</div>
|
<div Bad HTML</div>
|
||||||
|
@ -27,13 +27,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
new Worker(new Url('./url-worker.js', import.meta.url), { type: 'module' })
|
new Worker(new URL('./url-worker.js', import.meta.url), { type: 'module' })
|
||||||
<span class="classname">.worker-import-meta-url</span>
|
<span class="classname">.worker-import-meta-url</span>
|
||||||
</p>
|
</p>
|
||||||
<code class="worker-import-meta-url"></code>
|
<code class="worker-import-meta-url"></code>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
new SharedWorker(new Url('./url-shared-worker.js', import.meta.url), { type:
|
new SharedWorker(new URL('./url-shared-worker.js', import.meta.url), { type:
|
||||||
'module' })
|
'module' })
|
||||||
<span class="classname">.shared-worker-import-meta-url</span>
|
<span class="classname">.shared-worker-import-meta-url</span>
|
||||||
</p>
|
</p>
|
||||||
@ -46,13 +46,13 @@
|
|||||||
<code class="nested-worker"></code>
|
<code class="nested-worker"></code>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
new Worker(new Url('./classic-worker.js', import.meta.url))
|
new Worker(new URL('./classic-worker.js', import.meta.url))
|
||||||
<span class="classname">.classic-worker</span>
|
<span class="classname">.classic-worker</span>
|
||||||
</p>
|
</p>
|
||||||
<code class="classic-worker"></code>
|
<code class="classic-worker"></code>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
new SharedWorker(new Url('./classic-shared-worker.js', import.meta.url), {
|
new SharedWorker(new URL('./classic-shared-worker.js', import.meta.url), {
|
||||||
type: 'classic' })
|
type: 'classic' })
|
||||||
<span class="classname">.classic-shared-worker</span>
|
<span class="classname">.classic-shared-worker</span>
|
||||||
</p>
|
</p>
|
||||||
|
@ -75,7 +75,7 @@ react({
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
This option does not enable _code transformation_. That is handled by ESBuild.
|
This option does not enable _code transformation_. That is handled by esbuild.
|
||||||
|
|
||||||
**Note:** TypeScript syntax is handled automatically.
|
**Note:** TypeScript syntax is handled automatically.
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ See [2.9.0-beta.0 changelog](https://github.com/vitejs/vite/blob/v2.9.0-beta.0/p
|
|||||||
|
|
||||||
### Default preview port
|
### Default preview port
|
||||||
|
|
||||||
New default port for `vite preview` is 4173 (avoid conflicts in MacOS that took over the 5000 port)
|
New default port for `vite preview` is 4173 (avoid conflicts in macOS that took over the 5000 port)
|
||||||
|
|
||||||
### Workers using standard syntax
|
### Workers using standard syntax
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ import {
|
|||||||
checkPublicFile
|
checkPublicFile
|
||||||
} from './asset'
|
} from './asset'
|
||||||
import MagicString from 'magic-string'
|
import MagicString from 'magic-string'
|
||||||
import type * as Postcss from 'postcss'
|
import type * as PostCSS from 'postcss'
|
||||||
import type Sass from 'sass'
|
import type Sass from 'sass'
|
||||||
// We need to disable check of extraneous import which is buggy for stylus,
|
// We need to disable check of extraneous import which is buggy for stylus,
|
||||||
// and causes the CI tests fail, see: https://github.com/vitejs/vite/pull/2860
|
// and causes the CI tests fail, see: https://github.com/vitejs/vite/pull/2860
|
||||||
@ -59,8 +59,8 @@ export interface CSSOptions {
|
|||||||
preprocessorOptions?: Record<string, any>
|
preprocessorOptions?: Record<string, any>
|
||||||
postcss?:
|
postcss?:
|
||||||
| string
|
| string
|
||||||
| (Postcss.ProcessOptions & {
|
| (PostCSS.ProcessOptions & {
|
||||||
plugins?: Postcss.Plugin[]
|
plugins?: PostCSS.Plugin[]
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* Enables css sourcemaps during dev
|
* Enables css sourcemaps during dev
|
||||||
@ -617,7 +617,7 @@ async function compileCSS(
|
|||||||
): Promise<{
|
): Promise<{
|
||||||
code: string
|
code: string
|
||||||
map?: SourceMapInput
|
map?: SourceMapInput
|
||||||
ast?: Postcss.Result
|
ast?: PostCSS.Result
|
||||||
modules?: Record<string, string>
|
modules?: Record<string, string>
|
||||||
deps?: Set<string>
|
deps?: Set<string>
|
||||||
}> {
|
}> {
|
||||||
@ -735,7 +735,7 @@ async function compileCSS(
|
|||||||
postcssPlugins.push(
|
postcssPlugins.push(
|
||||||
UrlRewritePostcssPlugin({
|
UrlRewritePostcssPlugin({
|
||||||
replacer: urlReplacer
|
replacer: urlReplacer
|
||||||
}) as Postcss.Plugin
|
}) as PostCSS.Plugin
|
||||||
)
|
)
|
||||||
|
|
||||||
if (isModule) {
|
if (isModule) {
|
||||||
@ -911,8 +911,8 @@ function combineSourcemapsIfExists(
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface PostCSSConfigResult {
|
interface PostCSSConfigResult {
|
||||||
options: Postcss.ProcessOptions
|
options: PostCSS.ProcessOptions
|
||||||
plugins: Postcss.Plugin[]
|
plugins: PostCSS.Plugin[]
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resolvePostcssConfig(
|
async function resolvePostcssConfig(
|
||||||
@ -961,7 +961,7 @@ export const cssUrlRE =
|
|||||||
export const importCssRE = /@import ('[^']+\.css'|"[^"]+\.css"|[^'")]+\.css)/
|
export const importCssRE = /@import ('[^']+\.css'|"[^"]+\.css"|[^'")]+\.css)/
|
||||||
const cssImageSetRE = /image-set\(([^)]+)\)/
|
const cssImageSetRE = /image-set\(([^)]+)\)/
|
||||||
|
|
||||||
const UrlRewritePostcssPlugin: Postcss.PluginCreator<{
|
const UrlRewritePostcssPlugin: PostCSS.PluginCreator<{
|
||||||
replacer: CssUrlReplacer
|
replacer: CssUrlReplacer
|
||||||
}> = (opts) => {
|
}> = (opts) => {
|
||||||
if (!opts) {
|
if (!opts) {
|
||||||
@ -1094,11 +1094,11 @@ async function hoistAtImports(css: string) {
|
|||||||
return (await postcss.default([AtImportHoistPlugin]).process(css)).css
|
return (await postcss.default([AtImportHoistPlugin]).process(css)).css
|
||||||
}
|
}
|
||||||
|
|
||||||
const AtImportHoistPlugin: Postcss.PluginCreator<any> = () => {
|
const AtImportHoistPlugin: PostCSS.PluginCreator<any> = () => {
|
||||||
return {
|
return {
|
||||||
postcssPlugin: 'vite-hoist-at-imports',
|
postcssPlugin: 'vite-hoist-at-imports',
|
||||||
Once(root) {
|
Once(root) {
|
||||||
const imports: Postcss.AtRule[] = []
|
const imports: PostCSS.AtRule[] = []
|
||||||
root.walkAtRules((rule) => {
|
root.walkAtRules((rule) => {
|
||||||
if (rule.name === 'import') {
|
if (rule.name === 'import') {
|
||||||
// record in reverse so that can simply prepend to preserve order
|
// record in reverse so that can simply prepend to preserve order
|
||||||
|
Loading…
Reference in New Issue
Block a user