forked from nhn/tui.editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
70 lines (66 loc) · 1.62 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import typescript from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import fs from 'fs';
import banner from 'rollup-plugin-banner';
import { version, author, license } from './package.json';
function i18nEditorImportPath() {
return {
name: 'i18nEditorImportPath',
transform(code) {
return code.replace('../editorCore', '@toast-ui/editor');
},
};
}
const fileNames = fs.readdirSync('./src/i18n');
function createBannerPlugin(type) {
return banner(
[
`@toast-ui/editor${type ? ` : ${type}` : ''}`,
`@version ${version} | ${new Date().toDateString()}`,
`@author ${author}`,
`@license ${license}`,
].join('\n')
);
}
export default [
// editor
{
input: 'src/esm/index.ts',
output: {
dir: 'dist/esm',
format: 'es',
sourcemap: false,
},
plugins: [typescript(), commonjs(), nodeResolve(), createBannerPlugin()],
external: [/^prosemirror/],
},
// viewer
{
input: 'src/esm/indexViewer.ts',
output: {
dir: 'dist/esm',
format: 'es',
sourcemap: false,
},
plugins: [typescript(), commonjs(), nodeResolve(), createBannerPlugin('viewer')],
external: [/^prosemirror/],
},
// i18n
{
input: fileNames.map((fileName) => `src/i18n/${fileName}`),
output: {
dir: 'dist/esm/i18n',
format: 'es',
sourcemap: false,
},
external: ['@toast-ui/editor'],
plugins: [
typescript(),
commonjs(),
nodeResolve(),
i18nEditorImportPath(),
createBannerPlugin('i18n'),
],
},
];