-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
vite.config.js
45 lines (40 loc) · 1.12 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
import { resolve } from 'path';
import { defineConfig } from 'vite';
import { ViteEjsPlugin } from 'vite-plugin-ejs';
import { viteSingleFile } from 'vite-plugin-singlefile';
import { TransformEjs } from './src/lib/vite-plugins';
import { getRenderData } from './src/themes/data';
const dataFilename = process.env.DATA_FILENAME || './sample.cv.json'
const outDir = process.env.OUT_DIR || 'dist'
const data = require(dataFilename)
const renderData = getRenderData(data)
renderData.theme = process.env.THEME || 'reorx'
renderData.isProduction = process.env.NODE_ENV === 'production'
renderData.meta = {
title: data.basics.name,
description: data.basics.summary.replace('\n', ' '),
}
export default defineConfig({
build: {
outDir: outDir,
},
resolve: {
alias: {
// remove the "Module "fs" has been externalized" warning for ejs
'fs': 'src/lib/fs-polyfill.js',
},
},
plugins: [
TransformEjs(),
ViteEjsPlugin(
renderData,
{
ejs: (viteConfig) => ({
// ejs options goes here.
views: [resolve(__dirname)],
})
}
),
viteSingleFile(),
],
})