diff --git a/docs/.vitepress/config.js b/docs/.vitepress/config.js
index 68688c807b1662..36d995496ecfb5 100644
--- a/docs/.vitepress/config.js
+++ b/docs/.vitepress/config.js
@@ -57,8 +57,7 @@ module.exports = {
},
{
text: 'Changelog',
- link:
- 'https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md'
+ link: 'https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md'
}
]
},
diff --git a/docs/config/index.md b/docs/config/index.md
index 86c80ab63205ee..41b0bfe04a85b7 100644
--- a/docs/config/index.md
+++ b/docs/config/index.md
@@ -74,10 +74,10 @@ If the config needs to call async function, it can export a async function inste
```js
export default async ({ command, mode }) => {
- const data = await asyncFunction();
+ const data = await asyncFunction()
return {
// build specific config
- }
+ }
}
```
@@ -331,7 +331,7 @@ export default async ({ command, mode }) => {
Specify which IP addresses the server should listen on.
Set this to `0.0.0.0` to listen on all addresses, including LAN and public addresses.
-
+
This can be set via the CLI using `--host 0.0.0.0` or `--host`.
### server.port
@@ -444,8 +444,9 @@ export default async ({ command, mode }) => {
- **Type:** `string`
Restrict files that could be served via `/@fs/`. When `server.fsServe.strict` is set to `true`, accessing files outside this directory will result in a 403.
-
+
Vite will search for the root of the potential workspace and use it as default. A valid workspace met the following conditions, otherwise will fallback to the [project root](/guide/#index-html-and-project-root).
+
- contains `workspaces` field in `package.json`
- contains one of the following file
- `pnpm-workspace.yaml`
@@ -456,8 +457,8 @@ export default async ({ command, mode }) => {
export default {
server: {
fsServe: {
- // Allow serving files from one level up to the project root
- root: '..'
+ // Allow serving files from one level up to the project root
+ root: '..'
}
}
}
@@ -499,7 +500,7 @@ export default async ({ command, mode }) => {
- **Default:** `4096` (4kb)
Imported or referenced assets that are smaller than this threshold will be inlined as base64 URLs to avoid extra http requests. Set to `0` to disable inlining altogether.
-
+
::: tip Note
Assets will **always** be inlined, regardless of file size, and `build.assetsInlineLimit` will be ignored if you specify `build.lib`
:::
@@ -593,7 +594,7 @@ export default async ({ command, mode }) => {
- **Default:** `500`
Limit for chunk size warnings (in kbs).
-
+
### build.watch
- **Type:** [`WatcherOptions`](https://rollupjs.org/guide/en/#watch-options)`| null`
diff --git a/docs/guide/api-plugin.md b/docs/guide/api-plugin.md
index dd96508d5307b8..879e3a2aa0e4f9 100644
--- a/docs/guide/api-plugin.md
+++ b/docs/guide/api-plugin.md
@@ -35,11 +35,11 @@ import vitePlugin from 'vite-plugin-feature'
import rollupPlugin from 'rollup-plugin-feature'
export default {
- plugins: [ vitePlugin(), rollupPlugin() ]
+ plugins: [vitePlugin(), rollupPlugin()]
}
```
-Falsy plugins will be ignored, which can be used to easily activate or deactivate plugins.
+Falsy plugins will be ignored, which can be used to easily activate or deactivate plugins.
`plugins` also accept presets including several plugins as a single element. This is useful for complex features (like framework integration) that are implemented using several plugins. The array will be flattened internally.
@@ -49,10 +49,7 @@ import frameworkRefresh from 'vite-plugin-framework-refresh'
import frameworkDevtools from 'vite-plugin-framework-devtools'
export default function framework(config) {
- return [
- frameworkRefresh(config),
- frameworkDevTools(config)
- ]
+ return [frameworkRefresh(config), frameworkDevTools(config)]
}
```
@@ -61,9 +58,7 @@ export default function framework(config) {
import framework from 'vite-plugin-framework'
export default {
- plugins: [
- framework()
- ]
+ plugins: [framework()]
}
```
diff --git a/docs/guide/build.md b/docs/guide/build.md
index 7dd46ab435b9fa..dd1acfedc6db40 100644
--- a/docs/guide/build.md
+++ b/docs/guide/build.md
@@ -92,7 +92,7 @@ module.exports = {
}
```
-If you specify a different root, remember that `__dirname` will still be the folder of your vite.config.js file when resolving the input paths. Therfore, you will need to add your `root` entry to the arguments for `resolve`.
+If you specify a different root, remember that `__dirname` will still be the folder of your vite.config.js file when resolving the input paths. Therfore, you will need to add your `root` entry to the arguments for `resolve`.
## Library Mode
diff --git a/docs/guide/ssr.md b/docs/guide/ssr.md
index 452ddd902ba469..6aedaf9f55a556 100644
--- a/docs/guide/ssr.md
+++ b/docs/guide/ssr.md
@@ -243,4 +243,4 @@ export function mySSRPlugin() {
## SSR Target
-The default target for the SSR build is a node environment, but you can also run the server in a Web Worker. Packages entry resolution is different for each platform. You can configure the target to be Web Worker using the `ssr.target` set to `'webworker'`.
\ No newline at end of file
+The default target for the SSR build is a node environment, but you can also run the server in a Web Worker. Packages entry resolution is different for each platform. You can configure the target to be Web Worker using the `ssr.target` set to `'webworker'`.
diff --git a/docs/guide/using-plugins.md b/docs/guide/using-plugins.md
index 0eabf821ff6fb1..79b9b8a66188da 100644
--- a/docs/guide/using-plugins.md
+++ b/docs/guide/using-plugins.md
@@ -53,8 +53,8 @@ export default {
plugins: [
{
...image(),
- enforce: 'pre',
- },
+ enforce: 'pre'
+ }
]
}
```
@@ -73,8 +73,8 @@ export default {
plugins: [
{
...typescript2(),
- apply: 'build',
- },
+ apply: 'build'
+ }
]
}
```
diff --git a/package.json b/package.json
index 6f134ffbd374a3..b0924b6f7afa97 100644
--- a/package.json
+++ b/package.json
@@ -44,7 +44,7 @@
"node-fetch": "^2.6.1",
"npm-run-all": "^4.1.5",
"playwright-chromium": "^1.7.0",
- "prettier": "^2.2.1",
+ "prettier": "2.3.0",
"rimraf": "^3.0.2",
"semver": "^7.3.4",
"sirv": "^1.0.10",
diff --git a/packages/create-app/index.js b/packages/create-app/index.js
index dc9b752432958e..1cbfb075635d78 100755
--- a/packages/create-app/index.js
+++ b/packages/create-app/index.js
@@ -273,7 +273,8 @@ function copy(src, dest) {
}
async function getValidPackageName(projectName) {
- const packageNameRegExp = /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/
+ const packageNameRegExp =
+ /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/
if (packageNameRegExp.test(projectName)) {
return projectName
} else {
diff --git a/packages/create-app/template-lit-element-ts/package.json b/packages/create-app/template-lit-element-ts/package.json
index ee1ad19c500f95..b6cb14f43fda71 100644
--- a/packages/create-app/template-lit-element-ts/package.json
+++ b/packages/create-app/template-lit-element-ts/package.json
@@ -21,4 +21,4 @@
"vite": "^2.3.0",
"typescript": "^4.1.3"
}
-}
\ No newline at end of file
+}
diff --git a/packages/create-app/template-lit-element/package.json b/packages/create-app/template-lit-element/package.json
index 52749d237a6ab6..eaa91339695cea 100644
--- a/packages/create-app/template-lit-element/package.json
+++ b/packages/create-app/template-lit-element/package.json
@@ -18,4 +18,4 @@
"devDependencies": {
"vite": "^2.3.0"
}
-}
\ No newline at end of file
+}
diff --git a/packages/create-app/template-preact-ts/package.json b/packages/create-app/template-preact-ts/package.json
index ad8fe72d2d7196..eb28f12b75a0f4 100644
--- a/packages/create-app/template-preact-ts/package.json
+++ b/packages/create-app/template-preact-ts/package.json
@@ -14,4 +14,4 @@
"typescript": "^4.1.3",
"vite": "^2.3.0"
}
-}
\ No newline at end of file
+}
diff --git a/packages/create-app/template-preact/package.json b/packages/create-app/template-preact/package.json
index aea8892802497f..0becc082e85313 100644
--- a/packages/create-app/template-preact/package.json
+++ b/packages/create-app/template-preact/package.json
@@ -13,4 +13,4 @@
"@preact/preset-vite": "^2.0.0",
"vite": "^2.3.0"
}
-}
\ No newline at end of file
+}
diff --git a/packages/create-app/template-react-ts/package.json b/packages/create-app/template-react-ts/package.json
index 650302ebcf305c..14f9b4fde90b2b 100644
--- a/packages/create-app/template-react-ts/package.json
+++ b/packages/create-app/template-react-ts/package.json
@@ -17,4 +17,4 @@
"typescript": "^4.1.2",
"vite": "^2.3.0"
}
-}
\ No newline at end of file
+}
diff --git a/packages/create-app/template-react/package.json b/packages/create-app/template-react/package.json
index 286f318af7acb6..49d37ec2b3a5f3 100644
--- a/packages/create-app/template-react/package.json
+++ b/packages/create-app/template-react/package.json
@@ -14,4 +14,4 @@
"@vitejs/plugin-react-refresh": "^1.3.1",
"vite": "^2.3.0"
}
-}
\ No newline at end of file
+}
diff --git a/packages/create-app/template-svelte-ts/package.json b/packages/create-app/template-svelte-ts/package.json
index f5e791eed62ab5..8d73ce7dbabceb 100644
--- a/packages/create-app/template-svelte-ts/package.json
+++ b/packages/create-app/template-svelte-ts/package.json
@@ -13,4 +13,4 @@
"typescript": "^4.2.4",
"vite": "^2.3.0"
}
-}
\ No newline at end of file
+}
diff --git a/packages/create-app/template-svelte/package.json b/packages/create-app/template-svelte/package.json
index 7b184ea1f91e2d..aab7129c930879 100644
--- a/packages/create-app/template-svelte/package.json
+++ b/packages/create-app/template-svelte/package.json
@@ -11,4 +11,4 @@
"svelte": "^3.37.0",
"vite": "^2.3.0"
}
-}
\ No newline at end of file
+}
diff --git a/packages/create-app/template-vanilla-ts/package.json b/packages/create-app/template-vanilla-ts/package.json
index f62df8df9e8287..b168339e5c9f31 100644
--- a/packages/create-app/template-vanilla-ts/package.json
+++ b/packages/create-app/template-vanilla-ts/package.json
@@ -10,4 +10,4 @@
"typescript": "^4.2.3",
"vite": "^2.3.0"
}
-}
\ No newline at end of file
+}
diff --git a/packages/create-app/template-vanilla/package.json b/packages/create-app/template-vanilla/package.json
index cc44042642523f..096c8504a00d89 100644
--- a/packages/create-app/template-vanilla/package.json
+++ b/packages/create-app/template-vanilla/package.json
@@ -9,4 +9,4 @@
"devDependencies": {
"vite": "^2.3.0"
}
-}
\ No newline at end of file
+}
diff --git a/packages/create-app/template-vue-ts/package.json b/packages/create-app/template-vue-ts/package.json
index 5dfb0806338a3d..8c3110ed37bc04 100644
--- a/packages/create-app/template-vue-ts/package.json
+++ b/packages/create-app/template-vue-ts/package.json
@@ -16,4 +16,4 @@
"vite": "^2.3.0",
"vue-tsc": "^0.0.24"
}
-}
\ No newline at end of file
+}
diff --git a/packages/create-app/template-vue/package.json b/packages/create-app/template-vue/package.json
index e2c30dc7ce7dd8..035f26563680d5 100644
--- a/packages/create-app/template-vue/package.json
+++ b/packages/create-app/template-vue/package.json
@@ -14,4 +14,4 @@
"@vue/compiler-sfc": "^3.0.5",
"vite": "^2.3.0"
}
-}
\ No newline at end of file
+}
diff --git a/packages/playground/backend-integration/frontend/entrypoints/global.css b/packages/playground/backend-integration/frontend/entrypoints/global.css
index 3ea5728368521d..a120a71974e083 100644
--- a/packages/playground/backend-integration/frontend/entrypoints/global.css
+++ b/packages/playground/backend-integration/frontend/entrypoints/global.css
@@ -1,7 +1,8 @@
@import '~/styles/background.css';
@import '../../references.css';
-html, body {
+html,
+body {
font-family: sans-serif;
line-height: 2.4rem;
}
@@ -13,7 +14,7 @@ body {
}
ul {
- padding: 0 .4em;
+ padding: 0 0.4em;
margin: 0;
}
diff --git a/packages/playground/backend-integration/references.css b/packages/playground/backend-integration/references.css
index 3600be7cbb2f6f..262bf59c724f39 100644
--- a/packages/playground/backend-integration/references.css
+++ b/packages/playground/backend-integration/references.css
@@ -1,8 +1,8 @@
.asset-reference {
display: grid;
grid-template-areas:
- "summary preview ."
- "url url url";
+ 'summary preview .'
+ 'url url url';
}
.asset-url {
diff --git a/packages/playground/css-codesplit-cjs/main.css b/packages/playground/css-codesplit-cjs/main.css
index 24aec3a5671d8f..adc68fa6a4dfa0 100644
--- a/packages/playground/css-codesplit-cjs/main.css
+++ b/packages/playground/css-codesplit-cjs/main.css
@@ -1,3 +1,3 @@
-h1 {
+h1 {
color: red;
-}
\ No newline at end of file
+}
diff --git a/packages/playground/dynamic-import/mxd.json b/packages/playground/dynamic-import/mxd.json
index 9e26dfeeb6e641..0967ef424bce67 100644
--- a/packages/playground/dynamic-import/mxd.json
+++ b/packages/playground/dynamic-import/mxd.json
@@ -1 +1 @@
-{}
\ No newline at end of file
+{}
diff --git a/packages/playground/multiple-entrypoints/deps.json b/packages/playground/multiple-entrypoints/deps.json
index e5b880c83bc21b..cbf49c4172be3b 100644
--- a/packages/playground/multiple-entrypoints/deps.json
+++ b/packages/playground/multiple-entrypoints/deps.json
@@ -1 +1,27 @@
-{"a0":"./a0.js","a1":"./a1.js","a2":"./a2.js","a3":"./a3.js","a4":"./a4.js","a5":"./a5.js","a6":"./a6.js","a7":"./a7.js","a8":"./a8.js","a9":"./a9.js","a10":"./a10.js","a11":"./a11.js","a12":"./a12.js","a13":"./a13.js","a14":"./a14.js","a15":"./a15.js","a16":"./a16.js","a17":"./a17.js","a18":"./a18.js","a19":"./a19.js","a20":"./a20.js","a21":"./a21.js","a22":"./a22.js","a23":"./a23.js","a24":"./a24.js"}
\ No newline at end of file
+{
+ "a0": "./a0.js",
+ "a1": "./a1.js",
+ "a2": "./a2.js",
+ "a3": "./a3.js",
+ "a4": "./a4.js",
+ "a5": "./a5.js",
+ "a6": "./a6.js",
+ "a7": "./a7.js",
+ "a8": "./a8.js",
+ "a9": "./a9.js",
+ "a10": "./a10.js",
+ "a11": "./a11.js",
+ "a12": "./a12.js",
+ "a13": "./a13.js",
+ "a14": "./a14.js",
+ "a15": "./a15.js",
+ "a16": "./a16.js",
+ "a17": "./a17.js",
+ "a18": "./a18.js",
+ "a19": "./a19.js",
+ "a20": "./a20.js",
+ "a21": "./a21.js",
+ "a22": "./a22.js",
+ "a23": "./a23.js",
+ "a24": "./a24.js"
+}
diff --git a/packages/playground/multiple-entrypoints/reference.scss b/packages/playground/multiple-entrypoints/reference.scss
index e1367353e07e07..481c1db6c3a424 100644
--- a/packages/playground/multiple-entrypoints/reference.scss
+++ b/packages/playground/multiple-entrypoints/reference.scss
@@ -1 +1,3 @@
-.content { color: red; }
\ No newline at end of file
+.content {
+ color: red;
+}
diff --git a/packages/playground/ssr-vue/src/pages/Home.vue b/packages/playground/ssr-vue/src/pages/Home.vue
index 827bfd82ba7f7f..cd4b3d7680d71b 100644
--- a/packages/playground/ssr-vue/src/pages/Home.vue
+++ b/packages/playground/ssr-vue/src/pages/Home.vue
@@ -7,7 +7,7 @@
msg from virtual module: {{ foo.msg }}
-