Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vitejs/vite
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: [email protected]
Choose a base ref
...
head repository: vitejs/vite
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: [email protected]
Choose a head ref

Commits on Mar 5, 2021

  1. Copy the full SHA
    b05a567 View commit details
  2. fix: url linked to wmr rollup-plugin-container.js found 404 (#2368)

    Co-authored-by: ygj6 <@yuangongji@foxmail.com>
    yuangongji and ygj6 authored Mar 5, 2021
    Copy the full SHA
    209232c View commit details

Commits on Mar 6, 2021

  1. Copy the full SHA
    b5cd8c8 View commit details
  2. Copy the full SHA
    5d4e82d View commit details

Commits on Mar 7, 2021

  1. Copy the full SHA
    a8b4543 View commit details
  2. Copy the full SHA
    76f3535 View commit details

Commits on Mar 8, 2021

  1. chore: typo (#2423)

    tolu authored Mar 8, 2021
    1
    Copy the full SHA
    6720f65 View commit details
  2. chore: typo (#2420)

    fi3ework authored Mar 8, 2021
    1
    Copy the full SHA
    f4998c0 View commit details

Commits on Mar 9, 2021

  1. 1
    Copy the full SHA
    5ec13d8 View commit details

Commits on Mar 13, 2021

  1. 1
    Copy the full SHA
    f6ac860 View commit details
  2. doc: Commit log should follow semver rule (#2477)

    Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
    zk4 and antfu authored Mar 13, 2021
    1
    Copy the full SHA
    26c46b9 View commit details

Commits on Mar 14, 2021

  1. 1
    Copy the full SHA
    3220e57 View commit details

Commits on Mar 15, 2021

  1. chore: fix docs link to Project Root section (#2406)

    Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
    netchampfaris and antfu authored Mar 15, 2021
    2
    Copy the full SHA
    b65bc61 View commit details
  2. 1
    Copy the full SHA
    74e6f3d View commit details
  3. 1
    Copy the full SHA
    2cdb3f6 View commit details
  4. 1
    Copy the full SHA
    f7d85ae View commit details
  5. 1
    Copy the full SHA
    1dbf246 View commit details
  6. 1
    Copy the full SHA
    96ea9f4 View commit details
  7. 1
    Copy the full SHA
    b18af15 View commit details
  8. 1
    Copy the full SHA
    d3142cf View commit details
  9. 1
    Copy the full SHA
    ee7eb82 View commit details
  10. 1
    Copy the full SHA
    9243cc9 View commit details
  11. 1
    Copy the full SHA
    a5412f8 View commit details
  12. 1
    Copy the full SHA
    103dec9 View commit details
  13. docs: add awesome-vite link in Backend Integrations section (#1586)

    Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
    ElMassimo and antfu authored Mar 15, 2021
    1
    Copy the full SHA
    6d5c9c6 View commit details
  14. 1
    Copy the full SHA
    63bd250 View commit details
  15. docs: mention vue-tsc (#2497)

    zigomir authored Mar 15, 2021
    1
    Copy the full SHA
    fef0b56 View commit details
  16. 1
    Copy the full SHA
    b3b3c01 View commit details
  17. 1
    Copy the full SHA
    e8f3c78 View commit details
  18. 1
    Copy the full SHA
    c6f0b7c View commit details
  19. 1
    Copy the full SHA
    e034ee2 View commit details
  20. 1
    Copy the full SHA
    24c866f View commit details
  21. 1
    Copy the full SHA
    fd0a0d9 View commit details
  22. release: v2.1.0

    yyx990803 committed Mar 15, 2021
    1
    Copy the full SHA
    e3d74b4 View commit details
  23. release: create-app@2.1.0

    yyx990803 committed Mar 15, 2021
    1
    Copy the full SHA
    bcd458b View commit details
Showing with 929 additions and 222 deletions.
  1. +2 −2 .eslintrc.js
  2. +1 −1 .github/contributing.md
  3. +4 −0 docs/.vitepress/config.js
  4. +7 −7 docs/config/index.md
  5. +4 −1 docs/guide/backend-integration.md
  6. +1 −1 docs/guide/build.md
  7. +1 −1 docs/guide/features.md
  8. +1 −1 docs/guide/index.md
  9. +268 −0 docs/guide/static-deploy.md
  10. BIN docs/images/vercel-configuration.png
  11. +14 −0 packages/create-app/CHANGELOG.md
  12. +7 −0 packages/create-app/README.md
  13. +9 −1 packages/create-app/index.js
  14. +1 −1 packages/create-app/package.json
  15. +1 −1 packages/create-app/template-lit-element-ts/package.json
  16. +1 −1 packages/create-app/template-lit-element/package.json
  17. +1 −1 packages/create-app/template-preact-ts/package.json
  18. +1 −1 packages/create-app/template-preact/package.json
  19. +1 −1 packages/create-app/template-react-ts/package.json
  20. +1 −1 packages/create-app/template-react/package.json
  21. +1 −1 packages/create-app/template-vanilla/package.json
  22. +2 −1 packages/create-app/template-vue-ts/README.md
  23. +3 −2 packages/create-app/template-vue-ts/package.json
  24. +1 −1 packages/create-app/template-vue/package.json
  25. +10 −0 packages/playground/assets/__tests__/assets.spec.ts
  26. +14 −0 packages/playground/assets/index.html
  27. +1 −0 packages/playground/assets/vite.config.js
  28. BIN packages/playground/css/nested/asset.png
  29. +15 −1 packages/playground/json/__tests__/json.spec.ts
  30. +13 −1 packages/playground/json/index.html
  31. +28 −0 packages/vite/CHANGELOG.md
  32. +210 −30 packages/vite/LICENSE.md
  33. +3 −3 packages/vite/package.json
  34. +2 −2 packages/vite/src/node/cli.ts
  35. +43 −35 packages/vite/src/node/config.ts
  36. +2 −2 packages/vite/src/node/optimizer/esbuildDepPlugin.ts
  37. +6 −10 packages/vite/src/node/optimizer/index.ts
  38. +3 −5 packages/vite/src/node/optimizer/scan.ts
  39. +4 −4 packages/vite/src/node/plugins/css.ts
  40. +10 −35 packages/vite/src/node/plugins/esbuild.ts
  41. +4 −1 packages/vite/src/node/plugins/importAnalysis.ts
  42. +2 −0 packages/vite/src/node/plugins/json.ts
  43. +8 −3 packages/vite/src/node/plugins/manifest.ts
  44. +1 −1 packages/vite/src/node/plugins/resolve.ts
  45. +16 −4 packages/vite/src/node/{serve.ts → preview.ts}
  46. +21 −3 packages/vite/src/node/server/hmr.ts
  47. +1 −1 packages/vite/src/node/server/index.ts
  48. +5 −5 packages/vite/src/node/server/middlewares/proxy.ts
  49. +10 −9 packages/vite/src/node/server/pluginContainer.ts
  50. +6 −5 packages/vite/src/node/server/ws.ts
  51. +27 −0 packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts
  52. +54 −24 packages/vite/src/node/ssr/ssrTransform.ts
  53. +59 −6 packages/vite/src/node/utils.ts
  54. +18 −5 yarn.lock
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -12,15 +12,15 @@ module.exports = {
'error',
{
allowModules: ['types', 'estree', 'testUtils'],
tryExtensions: ['.ts', '.js', '.jsx', '.tsx']
tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts']
}
],
'node/no-missing-require': [
'error',
{
// for try-catching yarn pnp
allowModules: ['pnpapi'],
tryExtensions: ['.ts', '.js', '.jsx', '.tsx']
tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts']
}
],
'node/no-restricted-require': [
2 changes: 1 addition & 1 deletion .github/contributing.md
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ Some common test helpers, e.g. `testDir`, `isBuild` or `editFile` are available

- If fixing bug:

- If you are resolving a special issue, add `(fix #xxxx[,#xxxx])` (#xxxx is the issue id) in your PR title for a better release log, e.g. `update entities encoding/decoding (fix #3899)`.
- If you are resolving a special issue, add `(fix #xxxx[,#xxxx])` (#xxxx is the issue id) in your PR title for a better release log, e.g. `fix: update entities encoding/decoding (fix #3899)`.
- Provide a detailed description of the bug in the PR. Live demo preferred.
- Add appropriate test coverage if applicable. You can check the coverage of your code addition by running `yarn test --coverage`.

4 changes: 4 additions & 0 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
@@ -93,6 +93,10 @@ module.exports = {
text: 'Building for Production',
link: '/guide/build'
},
{
text: 'Deploying a Static Site',
link: '/guide/static-deploy'
},
{
text: 'Env Variables and Modes',
link: '/guide/env-and-mode'
14 changes: 7 additions & 7 deletions docs/config/index.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

### Config File Resolving

When running `vite` from the command line, Vite will automatically try to resolve a config file named `vite.config.js` inside [project root](/guide/#project-root).
When running `vite` from the command line, Vite will automatically try to resolve a config file named `vite.config.js` inside [project root](/guide/#index-html-and-project-root).

The most basic config file looks like this:

@@ -77,7 +77,7 @@ export default ({ command, mode }) => {

Project root directory (where `index.html` is located). Can be an absolute path, or a path relative from the location of the config file itself.

See [Project Root](/guide/#project-root) for more details.
See [Project Root](/guide/#index-html-and-project-root) for more details.

### base

@@ -170,14 +170,14 @@ export default ({ command, mode }) => {
### resolve.mainFields

- **Type:** `string[]`
- **Default:**: `['module', 'jsnext:main', 'jsnext']`
- **Default:** `['module', 'jsnext:main', 'jsnext']`

List of fields in `package.json` to try when resolving a package's entry point. Note this takes lower precedence than conditional exports resolved from the `exports` field: if an entry point is successfully resolved from `exports`, the main field will be ignored.

### resolve.extensions

- **Type:** `string[]`
- **Default:**: `['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json']`
- **Default:** `['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json']`

List of file extensions to try for imports that omit extensions. Note it is **NOT** recommended to omit extensions for custom import types (e.g. `.vue`) since it can interfere with IDE and type support.

@@ -240,7 +240,7 @@ export default ({ command, mode }) => {
- **Type:** `boolean`
- **Default:** `false`

If set to `true`, imported JSON will be transformed into `export default JSON.parse("...")` which is significantly more performant than Object literals, espeically when the JSON file is large.
If set to `true`, imported JSON will be transformed into `export default JSON.parse("...")` which is significantly more performant than Object literals, especially when the JSON file is large.

Enabling this disables named imports.

@@ -439,7 +439,7 @@ export default ({ command, mode }) => {
- **Type:** `string`
- **Default:** `dist`

Specify the output directory (relative to [project root](/guide/#project-root)).
Specify the output directory (relative to [project root](/guide/#index-html-and-project-root)).

### build.assetsDir

@@ -466,7 +466,7 @@ export default ({ command, mode }) => {

### build.sourcemap

- **Type:** `boolean`
- **Type:** `boolean | 'inline'`
- **Default:** `false`

Generate production source maps.
5 changes: 4 additions & 1 deletion docs/guide/backend-integration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Backend Integration

If you want to serve the HTML using a traditional backend (e.g. Rails, Laravel) but use Vite for serving assets, here's what you can do:
If you want to serve the HTML using a traditional backend (e.g. Rails, Laravel) but use Vite for serving assets, check for existing integrations listed in [Awesome Vite](https://github.com/vitejs/awesome-vite#integrations-with-backends).

Or you can follow these steps to configure it manually:

1. In your Vite config, configure the entry and enable build manifest:

@@ -83,3 +85,4 @@ If you want to serve the HTML using a traditional backend (e.g. Rails, Laravel)
<link rel="stylesheet" href="/assets/{{ manifest['main.js'].css }}" />
<script type="module" src="/assets/{{ manifest['main.js'].file }}"></script>
```

2 changes: 1 addition & 1 deletion docs/guide/build.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Building for Production

When it is time to deploy your app for production, simply run the `vite build` command. By default, it uses `<root>/index.html` as the build entry point, and produces an application bundle that is suitable to be served over a static hosting service.
When it is time to deploy your app for production, simply run the `vite build` command. By default, it uses `<root>/index.html` as the build entry point, and produces an application bundle that is suitable to be served over a static hosting service. Check out the [Deploying a Static Site](./static-deploy) for guides about popular services.

## Browser Compatibility

2 changes: 1 addition & 1 deletion docs/guide/features.md
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ Note you don't need to manually set these up - when you [create an app via `@vit

Vite supports importing `.ts` files out of the box.

Vite only performs transpilation on `.ts` files and does **NOT** perform type checking. It assumes type checking is taken care of by your IDE and build process (you can run `tsc --noEmit` in the build script).
Vite only performs transpilation on `.ts` files and does **NOT** perform type checking. It assumes type checking is taken care of by your IDE and build process (you can run `tsc --noEmit` in the build script or install `vue-tsc` and run `vue-tsc --noEmit` to also type check your `*.vue` files).

Vite uses [esbuild](https://github.com/evanw/esbuild) to transpile TypeScript into JavaScript which is about 20~30x faster than vanilla `tsc`, and HMR updates can reflect in the browser in under 50ms.

2 changes: 1 addition & 1 deletion docs/guide/index.md
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ One thing you may have noticed is that in a Vite project, `index.html` is front-

Vite treats `index.html` as source code and part of the module graph. It resolves `<script type="module" src="...">` that references your JavaScript source code. Even inline `<script type="module">` and CSS referenced via `<link href>` also enjoy Vite-specific features. In addition, URLs inside `index.html` are automatically rebased so there's no need for special `%PUBLIC_URL%` placeholders.

Similar to static http servers, Vite has the concept of a "root directory" from which your files are served from. You will see it referenced as `<root>` throughout the rest of the docs. Absolute URLs in your source code will be resolved using the project root as base, so you can write code as if you are working with a normal static file server (except way more powerful!). Vite is also capable of handling dependencies that resolve to out-of-root file system locations, which makes it usable even in a monorepo-based setup.
Similar to static http servers, Vite has the concept of a "root directory" which your files are served from. You will see it referenced as `<root>` throughout the rest of the docs. Absolute URLs in your source code will be resolved using the project root as base, so you can write code as if you are working with a normal static file server (except way more powerful!). Vite is also capable of handling dependencies that resolve to out-of-root file system locations, which makes it usable even in a monorepo-based setup.

Vite also supports [multi-page apps](./build#multi-page-app) with multiple `.html` entry points.

Loading