Skip to content

Commit b9978e3

Browse files
committed
fix: more progress on vite builds
1 parent cc82b3d commit b9978e3

File tree

6 files changed

+37
-17
lines changed

6 files changed

+37
-17
lines changed

index.html

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
<link rel="icon" type="image/png" href="/static/logo.png">
77
<meta name="viewport" content="width=device-width,initial-scale=1.0">
88
<!-- Verify with https://csp-evaluator.withgoogle.com/ -->
9-
<meta http-equiv="Content-Security-Policy" content="default-src 'self' <%= htmlWebpackPlugin.options.templateParameters.cspDefaultSrc %> https://api.github.com/repos/ActivityWatch/activitywatch/releases/latest; img-src 'self' data:; font-src 'self' data:; style-src 'self' 'unsafe-inline'; object-src 'none'; script-src 'self' 'unsafe-eval'">
9+
<!-- TODO: fix CSP (should depend on prod/dev mode, as pre-vite )-->
10+
<meta http-equiv="Content-Security-Policy" content="default-src 'self' *:5666 ws://*:27180 https://api.github.com/repos/ActivityWatch/activitywatch/releases/latest; img-src 'self' data:; font-src 'self' data:; style-src 'self' 'unsafe-inline'; object-src 'none'; script-src 'self' 'unsafe-eval'">
11+
<!-- TODO: is this really the way? imports in main.js doesn't seem to work -->
12+
<link rel="stylesheet" href="/node_modules/bootstrap/dist/css/bootstrap.css">
13+
<link rel="stylesheet" href="/node_modules/bootstrap-vue/dist/bootstrap-vue.css">
14+
<link rel="stylesheet" href="/src/style/style.scss">
1015
</head>
1116
<body>
1217
<noscript>

package-lock.json

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

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"vue-awesome": "^3.5.1",
6767
"vue-chartjs": "^4.1.0",
6868
"vue-color": "^2.8.1",
69-
"vue-d3-sunburst": "^1.9.0",
69+
"vue-d3-sunburst": "git+https://github.com/ErikBjare/Vue.D3.sunburst.git#patch-1",
7070
"vue-datetime": "^1.0.0-beta.13",
7171
"vuedraggable": "^2.24.3",
7272
"weekstart": "^1.0.1",

src/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import router from './route.js';
2828
import pinia from './stores';
2929

3030
// Register Font Awesome icon component
31-
Vue.component('icon', () => import('vue-awesome/components/Icon'));
31+
Vue.component('icon', () => import('vue-awesome/components/Icon.vue'));
3232

3333
// General components
3434
Vue.component('error-boundary', () => import('./components/ErrorBoundary.vue'));
@@ -80,7 +80,7 @@ import { createClient, getClient, configureClient } from './util/awclient';
8080
createClient();
8181

8282
// Setup Vue app
83-
import App from './App';
83+
import App from './App.vue';
8484
new Vue({
8585
el: '#app',
8686
router: router,

src/util/timeperiod.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import moment from 'moment';
2-
import { get_day_start_with_offset } from '~/util/time';
2+
import { get_day_start_with_offset } from './time';
33
import { useSettingsStore } from '~/stores/settings';
44

55
export interface TimePeriod {

vite.config.js

+22-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,26 @@ import path from 'node:path';
22
import { defineConfig } from 'vite';
33
import vue from '@vitejs/plugin-vue2';
44

5-
export default defineConfig({
6-
plugins: [vue()],
7-
publicDir: './static',
8-
resolve: {
9-
alias: { '/src': path.resolve(process.cwd(), 'src') },
10-
},
5+
export default defineConfig(({ mode }) => {
6+
const PRODUCTION = mode === 'production';
7+
8+
return {
9+
server: {
10+
port: 27180,
11+
headers: {
12+
'Content-Security-Policy': PRODUCTION ? "default-src 'self'" : "default-src 'self' *:5666",
13+
},
14+
},
15+
plugins: [vue()],
16+
publicDir: './static',
17+
resolve: {
18+
alias: { '~': path.resolve(__dirname, 'src') },
19+
},
20+
define: {
21+
PRODUCTION,
22+
AW_SERVER_URL: process.env.AW_SERVER_URL,
23+
COMMIT_HASH: process.env.COMMIT_HASH,
24+
'process.env.VUE_APP_ON_ANDROID': process.env.VUE_APP_ON_ANDROID,
25+
},
26+
};
1127
});

0 commit comments

Comments
 (0)