-
-
Notifications
You must be signed in to change notification settings - Fork 16.8k
Expand file tree
/
Copy pathvite.config.ts
More file actions
65 lines (63 loc) · 1.3 KB
/
vite.config.ts
File metadata and controls
65 lines (63 loc) · 1.3 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
import { resolve } from 'path';
import { ModuleFormat } from 'rollup';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import { rewriteLegacyCoreDtsPath } from './build/dts-paths.ts';
export const appendExtension = (format: ModuleFormat, name: String): string => {
if (format === 'es') {
return `${name}.mjs`;
} else {
return `${name}.js`;
}
};
export default defineConfig({
server: {
port: Number(process.env.npm_config_port || 8000),
},
build: {
target: ['es2015'],
emptyOutDir: true,
lib: {
formats: ['es', 'umd'],
entry: resolve(__dirname, 'js/index.ts'),
name: 'Reveal',
fileName: (format, entryName) => {
return appendExtension(format, 'reveal');
},
},
rollupOptions: {
output: {
assetFileNames: 'reveal.[ext]',
},
},
},
resolve: {
alias: {
// Matches the exported paths in package.json
'reveal.js/plugin': '/plugin',
'reveal.js': '/js',
'reveal.css': '/css/reveal.scss',
},
},
plugins: [
dts({
insertTypesEntry: true,
rollupTypes: false,
exclude: ['**/index.ts'],
copyDtsFiles: true,
beforeWriteFile(filePath, content) {
return {
filePath: rewriteLegacyCoreDtsPath(filePath),
content,
};
},
}),
],
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
},
},
},
});