Skip to content

Commit 1fb85c6

Browse files
authored
chore: update vite to 5 (#9937)
1 parent 08aabac commit 1fb85c6

File tree

9 files changed

+275
-149
lines changed

9 files changed

+275
-149
lines changed
File renamed without changes.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"sapui5",
99
"ui5"
1010
],
11+
"type": "module",
1112
"scripts": {
1213
"generate": "wsrun --exclude-missing generate",
1314
"generateAPI": "wsrun --exclude-missing generateAPI",
@@ -31,7 +32,7 @@
3132
"scopeWatch:fiori": "yarn workspace @ui5/webcomponents-fiori nps scope.watch",
3233
"startWithScope": "npm-run-all --sequential generate scopePrepare:main scopePrepare:compat scopePrepare:ai scopePrepare:fiori scopeStart:all",
3334
"start:all": "npm-run-all --parallel watch:allWithDelay dev",
34-
"dev": "node packages/tools/lib/dev-server/dev-server.js",
35+
"dev": "node packages/tools/lib/dev-server/dev-server.mjs",
3536
"scopeStart:all": "npm-run-all --parallel watch:base scopeWatch:main scopeWatch:compat scopeWatch:ai scopeWatch:fiori dev",
3637
"start:website": "yarn ci:releasebuild && yarn workspace @ui5/webcomponents-website start",
3738

packages/base/package-scripts.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const scripts = {
5656
default: 'concurrently "nps watch.src" "nps watch.styles"',
5757
withBundle: 'concurrently "nps watch.src" "nps watch.bundle" "nps watch.styles"',
5858
src: 'nps "copy.src --watch --skip-initial-copy"',
59-
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
59+
bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
6060
styles: 'chokidar "src/css/*.css" -c "nps generateStyles"'
6161
},
6262
test: {

packages/tools/components-package/cypress.config.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const { defineConfig } = require('cypress')
22
const path = require("path");
3-
const rootConfig = require("../../../vite.config.js");
43

54
module.exports = defineConfig({
65
component: {
@@ -10,7 +9,6 @@ module.exports = defineConfig({
109
devServer: {
1110
framework: 'cypress-ct-lit',
1211
bundler: 'vite',
13-
viteConfig: rootConfig,
1412
}
1513
},
1614
video: false,

packages/tools/components-package/nps.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const getScripts = (options) => {
111111
src: 'nps "copy.src --watch --safe --skip-initial-copy"',
112112
typescript: tsWatchCommandStandalone,
113113
props: 'nps "copyProps --watch --safe --skip-initial-copy"',
114-
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
114+
bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
115115
styles: {
116116
default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
117117
themes: 'nps "build.styles.themes -w"',
@@ -138,7 +138,7 @@ const getScripts = (options) => {
138138
},
139139
watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
140140
watch: 'concurrently "nps watch.templates" "nps watch.props" "nps watch.styles"',
141-
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
141+
bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
142142
},
143143
generateAPI: {
144144
default: tsOption ? "nps generateAPI.generateCEM generateAPI.validateCEM" : "",

packages/tools/lib/dev-server/dev-server.js renamed to packages/tools/lib/dev-server/dev-server.mjs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const fs = require("fs/promises");
2-
const { createServer } = require('vite');
3-
const yargs = require('yargs/yargs')
4-
const { hideBin } = require('yargs/helpers')
1+
import fs from "fs/promises";
2+
import { createServer } from 'vite';
3+
import yargs from 'yargs/yargs';
4+
import { hideBin } from 'yargs/helpers';
55

66
const argv = yargs(hideBin(process.argv))
77
.alias("c", "config")

packages/tools/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"resolve": "^1.20.0",
6969
"rimraf": "^3.0.2",
7070
"slash": "3.0.0",
71-
"vite": "^4.4.9",
71+
"vite": "^5.4.8",
7272
"wdio-chromedriver-service": "^7.3.2"
7373
},
7474
"peerDependencies": {

vite.config.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
const { defineConfig } = require('vite');
2-
const virtualIndex = require("@ui5/webcomponents-tools/lib/dev-server/virtual-index-html-plugin.js");
3-
const customHotUpdate = require("@ui5/webcomponents-tools/lib/dev-server/custom-hot-update-plugin.js");
4-
const { dirname, join, resolve } = require('path');
5-
const path = require('path');
6-
const tsconfigPaths = require('vite-tsconfig-paths').default;
7-
const { checker } = require('vite-plugin-checker');
1+
import { defineConfig } from 'vite';
2+
import virtualIndex from "@ui5/webcomponents-tools/lib/dev-server/virtual-index-html-plugin.js";
3+
import customHotUpdate from "@ui5/webcomponents-tools/lib/dev-server/custom-hot-update-plugin.js";
4+
import path, { dirname, join, resolve } from 'path';
5+
import tsconfigPaths from 'vite-tsconfig-paths';
6+
import { checker } from 'vite-plugin-checker';
87

98
// use after path.join and path.resolve as they turn paths to windows separators and comparisons and replacements stop working
109
const toPosixPath = (pathStr) => {
@@ -94,7 +93,7 @@ const customResolver = (id, source, options) => {
9493
}
9594
}
9695

97-
module.exports = defineConfig(async () => {
96+
export default defineConfig(async () => {
9897
return {
9998
build: {
10099
emptyOutDir: false,

yarn.lock

+258-130
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)