forked from rawilk/laravel-form-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
46 lines (44 loc) · 1.35 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
41
42
43
44
45
46
import md5 from 'md5';
import fs from 'fs-extra';
import babel from '@rollup/plugin-babel';
import filesize from 'rollup-plugin-filesize';
import { terser } from 'rollup-plugin-terser';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import outputManifest from 'rollup-plugin-output-manifest';
export default {
input: 'resources/js/index.js',
output: {
format: 'umd',
sourcemap: true,
name: 'FormComponents',
file: 'dist/form-components.js',
},
plugins: [
resolve(),
commonjs({
include: /node_modules\/(get-value|isobject|core-js)/,
}),
filesize(),
terser({
mangle: false,
compress: {
drop_debugger: false,
},
}),
babel({
exclude: 'node_modules/**',
babelHelpers: 'bundled',
}),
// Mimic Laravel Mix's mix-manifest file for auto-cache-busting.
outputManifest({
serialize() {
const file = fs.readFileSync(__dirname + '/dist/form-components.js', 'utf8');
const hash = md5(file).substring(0, 20);
return JSON.stringify({
'/form-components.js': '/form-components.js?id=' + hash,
});
},
}),
]
};