Skip to content

Commit ebcd151

Browse files
committed
webpack to vite
1 parent 0aa8744 commit ebcd151

File tree

8 files changed

+338
-392
lines changed

8 files changed

+338
-392
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ node_modules
55
/sessions
66
/.env*
77
/session-store.db
8+
/dist/

dist/.gitignore

-1
This file was deleted.

package-lock.json

+284-274
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"make:application": "osjs-cli make:application",
1818
"make:iframe-application": "osjs-cli make:iframe-application",
1919
"make:provider": "osjs-cli make:provider",
20-
"build": "webpack",
21-
"watch": "webpack --watch"
20+
"build": "vite build",
21+
"watch": "vite build --watch"
2222
},
2323
"keywords": [
2424
"osjs"
@@ -27,8 +27,7 @@
2727
"license": "BSD-2-Clause",
2828
"devDependencies": {
2929
"@osjs/dev-meta": "^2.1.0",
30-
"html-webpack-plugin": "^3.2.0",
31-
"source-map-loader": "^0.2.4"
30+
"vite": "^3.2.4"
3231
},
3332
"dependencies": {
3433
"@osjs/calculator-application": "^1.2.8",

src/client/index.ejs renamed to src/client/index.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
<meta name="google" content="notranslate" />
1111
<meta name="description" content="OS.js - JavaScript Cloud/Web Desktop Platform" />
1212
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
13-
<title><%= htmlWebpackPlugin.options.title %></title>
13+
<title>OS.js</title>
14+
<script src="index.js" type="module" defer></script>
15+
<link rel="icon" href="favicon.png">
1416
</head>
1517
<body>
1618
</body>

src/client/index.scss

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
// OS.js defaults.
3535
//
3636

37-
@import "~typeface-roboto/index.css";
38-
@import "~@osjs/client/dist/main.css";
39-
@import "~@osjs/gui/dist/main.css";
40-
@import "~@osjs/dialogs/dist/main.css";
41-
@import "~@osjs/panels/dist/main.css";
37+
@import "typeface-roboto/index.css";
38+
@import "@osjs/client/dist/main.css";
39+
@import "@osjs/gui/dist/main.css";
40+
@import "@osjs/dialogs/dist/main.css";
41+
@import "@osjs/panels/dist/main.css";
4242

4343
body,
4444
html {

vite.config.js

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// @ts-ignore
2+
const npm = require('./package.json');
3+
4+
const assetsDir = '';
5+
6+
const outputDefaults = {
7+
// remove hashes from filenames
8+
entryFileNames: `${assetsDir}[name].js`,
9+
chunkFileNames: `${assetsDir}[name].js`,
10+
assetFileNames: `${assetsDir}[name].[ext]`,
11+
};
12+
13+
/** @type {import("vite").UserConfig} */
14+
module.exports = {
15+
clearScreen: false,
16+
root: "src/client",
17+
base: "./", // generate relative paths in html
18+
define: {
19+
OSJS_VERSION: JSON.stringify(npm.version),
20+
},
21+
worker: {
22+
rollupOptions: {
23+
output: {
24+
...outputDefaults,
25+
}
26+
},
27+
},
28+
build: {
29+
outDir: "../../dist", // relative to root
30+
emptyOutDir: true,
31+
target: 'esnext',
32+
minify: false,
33+
sourcemap: true,
34+
rollupOptions: {
35+
output: {
36+
...outputDefaults,
37+
},
38+
},
39+
},
40+
plugins: [
41+
],
42+
};

webpack.config.js

-107
This file was deleted.

0 commit comments

Comments
 (0)