-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathrollup.config.js
38 lines (38 loc) · 1.19 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
const {getStaticPath} = require('./util/index')
const path = require('path')
const alias = require('@rollup/plugin-alias')
const {nodeResolve} = require('@rollup/plugin-node-resolve')
const commonjs = require('@rollup/plugin-commonjs')
const { createFilter }= require('@rollup/pluginutils');
export default {
input: 'ui/src/app.js',
plugins: [
alias({
entries: [
{ find: '@', replacement: path.join(__dirname, 'ui/src') },
]
}),
(function text() {
return {
name: 'text',
transform ( data, id ) {
const filter = createFilter( [ '**/*.md','**/*.txt','**/*.html'], undefined );
if ( !filter( id ) ) return null;
return {
code: `export default ${JSON.stringify(data.toString())};`,
map: { mappings: '' }
};
}
}
})(),
commonjs(),
nodeResolve()
],
output: {
file: path.join(getStaticPath(),'bundle.js'),
format: 'esm'
},
watch: {
include: 'ui/**'
}
};