2023-09-20 06:36:43 +02:00
|
|
|
/*
|
|
|
|
* vite.config.js
|
2024-04-07 10:12:23 +02:00
|
|
|
* Copyright (c) 2024 james@firefly-iii.org.
|
2023-09-20 06:36:43 +02:00
|
|
|
*
|
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
2024-04-07 10:12:23 +02:00
|
|
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
2023-09-20 06:36:43 +02:00
|
|
|
*/
|
|
|
|
|
2023-07-11 14:42:57 +02:00
|
|
|
import {defineConfig} from 'vite';
|
2023-07-11 11:45:55 +02:00
|
|
|
import laravel from 'laravel-vite-plugin';
|
2024-04-14 08:51:59 +02:00
|
|
|
import manifestSRI from 'vite-plugin-manifest-sri';
|
2024-04-20 16:18:41 +02:00
|
|
|
import * as fs from "fs";
|
2023-07-11 11:45:55 +02:00
|
|
|
|
2023-08-06 07:02:55 +02:00
|
|
|
const host = '127.0.0.1';
|
2023-07-11 11:45:55 +02:00
|
|
|
|
2024-01-02 15:41:14 +01:00
|
|
|
function manualChunks(id) {
|
|
|
|
if (id.includes('node_modules')) {
|
|
|
|
return 'vendor';
|
|
|
|
}
|
2024-03-10 16:52:59 +01:00
|
|
|
}
|
2024-01-02 15:41:14 +01:00
|
|
|
|
2024-04-23 07:00:08 +02:00
|
|
|
export default defineConfig(({command, mode, isSsrBuild, isPreview}) => {
|
|
|
|
|
|
|
|
let https = null;
|
|
|
|
if (command === 'serve') {
|
|
|
|
https = {
|
2025-06-01 13:32:18 +02:00
|
|
|
key: fs.readFileSync(`/vagrant/tls-certificates/wildcard.sd.internal.key`),
|
|
|
|
cert: fs.readFileSync(`/vagrant/tls-certificates/wildcard.sd.internal.crt`),
|
2024-04-23 07:00:08 +02:00
|
|
|
};
|
|
|
|
}
|
2024-03-09 12:11:06 +01:00
|
|
|
|
2024-04-23 07:00:08 +02:00
|
|
|
return {
|
|
|
|
base: './',
|
|
|
|
build: {
|
|
|
|
rollupOptions: {
|
|
|
|
output: {
|
|
|
|
manualChunks,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
laravel({
|
|
|
|
input: [
|
|
|
|
// css
|
|
|
|
'src/sass/app.scss',
|
2024-01-07 12:51:42 +01:00
|
|
|
|
2024-04-23 07:00:08 +02:00
|
|
|
// dashboard
|
|
|
|
'src/pages/dashboard/dashboard.js',
|
2024-03-04 20:41:34 +01:00
|
|
|
|
2024-04-23 07:00:08 +02:00
|
|
|
// accounts
|
|
|
|
'src/pages/accounts/index.js',
|
2024-03-31 16:46:20 +02:00
|
|
|
|
2024-04-23 07:00:08 +02:00
|
|
|
// administrations
|
|
|
|
'src/pages/administrations/index.js',
|
|
|
|
'src/pages/administrations/create.js',
|
|
|
|
'src/pages/administrations/edit.js',
|
2024-01-02 15:41:14 +01:00
|
|
|
|
2024-04-23 07:00:08 +02:00
|
|
|
// transactions
|
|
|
|
'src/pages/transactions/create.js',
|
|
|
|
'src/pages/transactions/edit.js',
|
|
|
|
'src/pages/transactions/show.js',
|
|
|
|
'src/pages/transactions/index.js',
|
|
|
|
],
|
|
|
|
publicDirectory: '../../../public',
|
|
|
|
refresh: true,
|
|
|
|
}),
|
|
|
|
//manifestSRI(),
|
2023-07-11 11:45:55 +02:00
|
|
|
|
2024-04-23 07:00:08 +02:00
|
|
|
],
|
2023-07-11 11:45:55 +02:00
|
|
|
|
2024-04-23 07:00:08 +02:00
|
|
|
|
|
|
|
server: {
|
2025-03-23 09:05:06 +01:00
|
|
|
cors: true,
|
2025-07-20 12:32:53 +02:00
|
|
|
// make sure this IP matches the IP of the dev machine.
|
|
|
|
origin: 'https://192.168.96.162:5173',
|
2024-04-23 07:00:08 +02:00
|
|
|
watch: {
|
|
|
|
usePolling: true,
|
|
|
|
},
|
2025-03-23 09:05:06 +01:00
|
|
|
port: 5173,
|
|
|
|
host: true,
|
2024-04-23 07:00:08 +02:00
|
|
|
// hmr: {
|
|
|
|
// protocol: 'wss',
|
|
|
|
// },
|
|
|
|
https: https,
|
2024-04-21 17:09:15 +02:00
|
|
|
},
|
2024-04-23 07:00:08 +02:00
|
|
|
}
|
2023-07-11 11:45:55 +02:00
|
|
|
});
|