-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
74 lines (73 loc) · 2.78 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
71
72
73
74
import json from '@rollup/plugin-json'
import copy from 'rollup-plugin-copy'
import replace from '@rollup/plugin-replace'
import html from 'rollup-plugin-html'
import css from 'rollup-plugin-import-css'
import nodeResolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript'
import sourcemaps from 'rollup-plugin-sourcemaps'
import del from 'rollup-plugin-delete'
import babel from "@rollup/plugin-babel";
import multi from '@rollup/plugin-multi-entry';
import commonjs from "@rollup/plugin-commonjs";
export default {
input: {
include: ['src/**/*.ts'],
entryFileName: 'bundle.js'
},
output: {
sourcemap: true,
dir: 'dist/dist',
// entryFileNames: 'bundle.js',
format: 'cjs',
esModule: false,
intro: 'try{if(!exports){exports = {};} }catch(e){var exports = {}};'
// intro: `try{exports}catch(e){exports = {}}; if (!Object.defineProperty) Object.defineProperty = function(obj, prop, descriptor) {obj[prop] = descriptor.value;};`
},
plugins: [
commonjs(),
babel({babelHelpers: 'bundled'}),
multi({
entryFileNames: 'bundle.js'
}),
// nodeResolve({
// customResolveOptions: {
// moduleDirectory: 'node_modules'
// }
// }),
// css(),
// html({ include: '**/*.html' }),
// json(),
// copy({
// targets: [
// { src: 'index.html', dest: 'dist-front' },
// { src: 'offline.html', dest: 'dist-front' },
// { src: 'service-worker.js', dest: 'dist-front' },
// { src: 'manifest.json', dest: 'dist-front' },
// { src: 'pwabuilder-sw.js', dest: 'dist-front' },
// { src: 'favicon.ico', dest: 'dist-front' },
// { src: 'assets', dest: 'dist-front' }
// ]
// }),
// resolve(),
typescript({tsconfig: 'tsconfig.rollup.json'}),
// typescript({ tsconfig: './tsconfig.front.json', clean: true }),
// sourcemaps(),
// replace({
// preventAssignment: true,
// "Object.defineProperty(exports, '__esModule', { value: true });": "",
// delimiters: ['\n', '\n']
// }),
replace({
preventAssignment: true,
'exports.': 'window.',
delimiters: ['\n', '\n']
}),
// replace({
// preventAssignment: true,
// "Object.defineProperty(exports, '__esModule', { value: true });": "try{if(!exports) {var exports = {}}}catch (e) {var exports = {}} Object.defineProperty(exports, '__esModule', { value: true });",
// delimiters: ['\n', '\n']
// }),
del({targets: ['dist/dist/*']})
]
};