Skip to content

Commit eced3cb

Browse files
authored
Merge pull request #269 from timacdonald/vite-5
[1.x] Vite 5
2 parents b77e7ad + d79067a commit eced3cb

File tree

6 files changed

+38
-10
lines changed

6 files changed

+38
-10
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
strategy:
2020
matrix:
21-
node-version: [14.x, 16.x, 18.x]
21+
node-version: [18.x, 20.x, 21.x]
2222

2323
steps:
2424
- name: Checkout code

UPGRADE.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Upgrade Guide
22

3+
## `0.x` to `1.x`
4+
5+
This release adds support for Vite 5 and removes support for Vite 3 and 4.
6+
7+
### Notable Changes
8+
9+
1. Dropped support for CJS: https://github.com/laravel/vite-plugin/pull/235
10+
2. Dropped support for a `boolean` value of `server.https` option in `vite.config.js`: https://github.com/laravel/vite-plugin/pull/254
11+
12+
### Upgrade Path
13+
14+
1. Update to the latest version of the `laravel-vite-plugin`, `vite`, and any Vite plugins you may have installed, such as [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue) or [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react).
15+
16+
The following command will update `laravel-vite-plugin` and `vite` only:
17+
18+
```
19+
npm install vite@^5.0.0 laravel-vite-plugin@^1.x
20+
```
21+
22+
You should also check the upgrade guide and changelogs for any packages you update. The [`vite` migrations guide](https://vitejs.dev/guide/migration.html) is available on their website.
23+
24+
2. Ensure your `package.json` contains `"type": "module"`.
25+
26+
Run the following command in your project's root directory or anywhere you have your `package.json` files:
27+
28+
```sh
29+
npm pkg set type=module
30+
```
31+
32+
You may also need to rename any `*.js` configuration files that contain CJS, which is the older-style Node-flavored `var plugin = require('plugin')` syntax, to `filename.cjs` after making this change.
33+
334
## Migrating from Laravel Mix to Vite
435

536
> **Note**

import.meta.url-polyfill.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@
4949
"esbuild": "0.16.10",
5050
"eslint": "^8.14.0",
5151
"typescript": "^4.6.4",
52-
"vite": "^4.0.0",
52+
"vite": "^5.0.0",
5353
"vitest": "^0.34.4"
5454
},
5555
"peerDependencies": {
56-
"vite": "^3.0.0 || ^4.0.0"
56+
"vite": "^5.0.0"
5757
},
5858
"engines": {
59-
"node": ">=14"
59+
"node": "^18.0.0 || >=20.0.0"
6060
},
6161
"dependencies": {
6262
"picocolors": "^1.0.0",

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
160160
...serverConfig.hmr,
161161
...(userConfig.server?.hmr === true ? {} : userConfig.server?.hmr),
162162
},
163-
https: userConfig.server?.https === false ? false : {
163+
https: typeof userConfig.server?.https !== 'undefined' ? userConfig.server.https : {
164164
...serverConfig.https,
165165
...(userConfig.server?.https === true ? {} : userConfig.server?.https),
166166
},

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"compilerOptions": {
33
"outDir": "./dist",
44
"target": "ES2020",
5-
"module": "ES2020",
6-
"moduleResolution": "node",
5+
"module": "NodeNext",
6+
"moduleResolution": "NodeNext",
77
"resolveJsonModule": true,
88
"strict": true,
99
"declaration": true,

0 commit comments

Comments
 (0)