-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.mjs
45 lines (42 loc) · 1.04 KB
/
vite.config.mjs
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 { defineConfig } from 'vite'
import { dependencies } from './package.json';
import license from 'rollup-plugin-license'
import { resolve } from 'path'
const externalPackages = [
...Object.keys(dependencies || {}),
];
// Creating regexes of the packages to make sure subpaths of the
// packages are also treated as external
const regexesOfPackages = externalPackages.map(
(packageName) => new RegExp(`^${packageName}(/.*)?`),
);
export default defineConfig({
optimizeDeps: {
include: ['body-scroll-lock'],
},
build: {
lib: {
entry: resolve(__dirname, 'be-a11y.js'),
name: '@beapi/be-a11y',
fileName: 'be-a11y',
},
rollupOptions: {
output: [
{
dir: 'dist',
format: 'es',
preserveModules: true,
entryFileNames: '[name].js',
},
],
external: regexesOfPackages,
plugins: [
license({
thirdParty: {
output: resolve(__dirname, './dist/vendor.LICENSE.txt'),
},
}),
],
},
},
})