Skip to content

Commit

Permalink
Merge pull request #269 from timacdonald/vite-5
Browse files Browse the repository at this point in the history
[1.x] Vite 5
  • Loading branch information
timacdonald authored Dec 15, 2023
2 parents b77e7ad + d79067a commit eced3cb
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

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

steps:
- name: Checkout code
Expand Down
31 changes: 31 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# Upgrade Guide

## `0.x` to `1.x`

This release adds support for Vite 5 and removes support for Vite 3 and 4.

### Notable Changes

1. Dropped support for CJS: https://github.com/laravel/vite-plugin/pull/235
2. Dropped support for a `boolean` value of `server.https` option in `vite.config.js`: https://github.com/laravel/vite-plugin/pull/254

### Upgrade Path

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).

The following command will update `laravel-vite-plugin` and `vite` only:

```
npm install vite@^5.0.0 laravel-vite-plugin@^1.x
```

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.

2. Ensure your `package.json` contains `"type": "module"`.

Run the following command in your project's root directory or anywhere you have your `package.json` files:

```sh
npm pkg set type=module
```

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.

## Migrating from Laravel Mix to Vite

> **Note**
Expand Down
3 changes: 0 additions & 3 deletions import.meta.url-polyfill.js

This file was deleted.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
"esbuild": "0.16.10",
"eslint": "^8.14.0",
"typescript": "^4.6.4",
"vite": "^4.0.0",
"vite": "^5.0.0",
"vitest": "^0.34.4"
},
"peerDependencies": {
"vite": "^3.0.0 || ^4.0.0"
"vite": "^5.0.0"
},
"engines": {
"node": ">=14"
"node": "^18.0.0 || >=20.0.0"
},
"dependencies": {
"picocolors": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
...serverConfig.hmr,
...(userConfig.server?.hmr === true ? {} : userConfig.server?.hmr),
},
https: userConfig.server?.https === false ? false : {
https: typeof userConfig.server?.https !== 'undefined' ? userConfig.server.https : {
...serverConfig.https,
...(userConfig.server?.https === true ? {} : userConfig.server?.https),
},
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"compilerOptions": {
"outDir": "./dist",
"target": "ES2020",
"module": "ES2020",
"moduleResolution": "node",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"resolveJsonModule": true,
"strict": true,
"declaration": true,
Expand Down

0 comments on commit eced3cb

Please sign in to comment.