mirror of
https://github.com/heyman/heynote.git
synced 2024-12-28 09:39:05 +01:00
079fa666d6
* Move windows.darkMode -> window.heynote.themeMode * Only add UpdateStatusItem if window.heynote.autoUpdate is set * Update Vite * Implement web version of Heynote. Add a child vite project in ./webapp/ that is Heynote running within a browser. Imports almost all code from ../src/ and only adds a thin bridge that corresponds to the API between the Electron main process and the app code. * Remove commented out tag * Specify publicDir in vite config, instead of using a symlink * Add webapp_dev npm command to package.json * Add npm run command: webapp:build * Add resolve alias '@' that points to project root. Move assets file from public to assets in order to let Vite/Rollup handle bundling.
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
import path from 'path'
|
|
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
//import { directoryPlugin } from "vite-plugin-list-directory-contents";
|
|
|
|
|
|
const middleware = () => {
|
|
return {
|
|
name: 'middleware',
|
|
apply: 'serve',
|
|
configureServer(viteDevServer) {
|
|
return () => {
|
|
viteDevServer.middlewares.use(async (req, res, next) => {
|
|
console.log("url:", req.originalUrl)
|
|
if (!req.originalUrl.endsWith(".html") && req.originalUrl !== "/") {
|
|
req.url = `/src` + req.originalUrl + ".html";
|
|
} else if (req.url === "/index.html") {
|
|
//req.url = `/src` + req.url;
|
|
}
|
|
|
|
next();
|
|
});
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
publicDir: "../public",
|
|
|
|
plugins: [
|
|
vue(),
|
|
//directoryPlugin({ baseDir: __dirname }),
|
|
],
|
|
|
|
css: {
|
|
preprocessorOptions: {
|
|
sass: {
|
|
additionalData: `
|
|
@import "../src/css/include.sass"
|
|
`
|
|
},
|
|
},
|
|
},
|
|
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, '..'),
|
|
},
|
|
},
|
|
})
|