mirror of
https://github.com/hakimel/reveal.js.git
synced 2025-10-25 12:16:16 +02:00
48 lines
982 B
TypeScript
48 lines
982 B
TypeScript
import { resolve } from 'path';
|
|
import { ModuleFormat } from 'rollup';
|
|
import { defineConfig } from 'vite';
|
|
import dts from 'vite-plugin-dts';
|
|
|
|
export const appendExtension = (format: ModuleFormat, name: String): string => {
|
|
if (format === 'es') {
|
|
return `${name}.mjs`;
|
|
} else {
|
|
return `${name}.js`;
|
|
}
|
|
};
|
|
|
|
export default defineConfig({
|
|
build: {
|
|
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: true })],
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {
|
|
api: 'modern-compiler',
|
|
},
|
|
},
|
|
},
|
|
});
|