-
Notifications
You must be signed in to change notification settings - Fork 9
/
vite.config.js
53 lines (47 loc) · 1.49 KB
/
vite.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* eslint-env node */
import { resolve } from 'path';
import dotenv from 'dotenv';
import handlebars from 'vite-plugin-handlebars';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import { version } from './package.json';
import structuredData from './app/templates/includes/structuredData.json';
structuredData.softwareVersion = version;
export default () => {
const root = resolve(__dirname, 'app');
dotenv.config({
path: resolve(root, '.env')
});
const globals = {
__VERSION__: JSON.stringify(version),
NOTESREVIEW_API_URL: JSON.stringify(process.env.NOTESREVIEW_API_URL),
OPENSTREETMAP_SERVER: JSON.stringify(process.env.OPENSTREETMAP_SERVER),
OPENSTREETMAP_OAUTH_CLIENT_ID: JSON.stringify(process.env.OPENSTREETMAP_OAUTH_CLIENT_ID),
OPENSTREETMAP_OAUTH_CLIENT_SECRET: JSON.stringify(process.env.OPENSTREETMAP_OAUTH_CLIENT_SECRET),
MAPILLARY_CLIENT_ID: JSON.stringify(process.env.MAPILLARY_CLIENT_ID)
};
return {
base: '/NotesReview/',
root,
define: globals,
build: {
sourcemap: true
},
plugins: [
handlebars({
partialDirectory: [
resolve(root, 'templates'),
resolve(root, 'templates/includes'),
resolve(root, 'templates/modals')
],
context: {
structuredData: JSON.stringify(structuredData),
version
}
}),
createSvgIconsPlugin({
iconDirs: [resolve(root, 'svg')],
symbolId: '[dir]-[name]'
})
]
};
};