forked from activeadmin/activeadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
40 lines (36 loc) · 1.02 KB
/
rollup.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
import path from 'node:path';
import { URL, fileURLToPath } from 'node:url';
import { readFileSync } from 'node:fs';
import alias from '@rollup/plugin-alias';
const packageJson = JSON.parse(
readFileSync(new URL('./package.json', import.meta.url))
);
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const projectRootDir = path.resolve(__dirname);
const assetsDir = path.resolve(projectRootDir, 'app/javascript');
/**
* @type {import('rollup').RollupOptions}
*/
export default [
// build dist folder with all files from app/javascript using relative imports.
// let bundler tools like webpack or rollup to process our package
{
input: ['app/javascript/active_admin.js'],
output: {
format: 'es',
dir: 'dist',
preserveModules: true,
},
external: Object.keys(packageJson.dependencies),
plugins: [
alias({
entries: [
{
find: 'active_admin',
replacement: path.join(assetsDir, 'active_admin'),
},
]
})
]
}
];