Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack to vite #814

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
/sessions
/.env*
/session-store.db
/dist/
1 change: 0 additions & 1 deletion dist/.gitignore

This file was deleted.

558 changes: 284 additions & 274 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"make:application": "osjs-cli make:application",
"make:iframe-application": "osjs-cli make:iframe-application",
"make:provider": "osjs-cli make:provider",
"build": "webpack",
"watch": "webpack --watch"
"build": "vite build",
"watch": "vite build --watch"
},
"keywords": [
"osjs"
Expand All @@ -27,8 +27,7 @@
"license": "BSD-2-Clause",
"devDependencies": {
"@osjs/dev-meta": "^2.1.0",
"html-webpack-plugin": "^3.2.0",
"source-map-loader": "^0.2.4"
"vite": "^3.2.4"
},
"dependencies": {
"@osjs/calculator-application": "^1.2.8",
Expand Down
4 changes: 3 additions & 1 deletion src/client/index.ejs → src/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<meta name="google" content="notranslate" />
<meta name="description" content="OS.js - JavaScript Cloud/Web Desktop Platform" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<title><%= htmlWebpackPlugin.options.title %></title>
<title>OS.js</title>
<script src="index.js" type="module" defer></script>
<link rel="icon" href="favicon.png">
</head>
<body>
</body>
Expand Down
10 changes: 5 additions & 5 deletions src/client/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
// OS.js defaults.
//

@import "~typeface-roboto/index.css";
@import "~@osjs/client/dist/main.css";
@import "~@osjs/gui/dist/main.css";
@import "~@osjs/dialogs/dist/main.css";
@import "~@osjs/panels/dist/main.css";
@import "typeface-roboto/index.css";
@import "@osjs/client/dist/main.css";
@import "@osjs/gui/dist/main.css";
@import "@osjs/dialogs/dist/main.css";
@import "@osjs/panels/dist/main.css";

body,
html {
Expand Down
42 changes: 42 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// @ts-ignore
const npm = require('./package.json');

const assetsDir = '';

const outputDefaults = {
// remove hashes from filenames
entryFileNames: `${assetsDir}[name].js`,
chunkFileNames: `${assetsDir}[name].js`,
assetFileNames: `${assetsDir}[name].[ext]`,
};

/** @type {import("vite").UserConfig} */
module.exports = {
clearScreen: false,
root: "src/client",
base: "./", // generate relative paths in html
define: {
OSJS_VERSION: JSON.stringify(npm.version),
},
worker: {
rollupOptions: {
output: {
...outputDefaults,
}
},
},
build: {
outDir: "../../dist", // relative to root
emptyOutDir: true,
target: 'esnext',
minify: false,
sourcemap: true,
rollupOptions: {
output: {
...outputDefaults,
},
},
},
plugins: [
],
};
107 changes: 0 additions & 107 deletions webpack.config.js

This file was deleted.