This repository has been archived by the owner on Nov 21, 2021. It is now read-only.
/
rollup.config.ts
50 lines (41 loc) · 1.48 KB
/
rollup.config.ts
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
import rollupPluginNodeResolve from 'rollup-plugin-node-resolve';
import rollupPluginCommonjs from 'rollup-plugin-commonjs';
import rollupPluginSourcemaps from 'rollup-plugin-sourcemaps';
import lodashCamelcase from 'lodash.camelcase';
import rollupPluginTypescript2 from 'rollup-plugin-typescript2';
import rollupPluginJson from 'rollup-plugin-json';
const pkg = require('./package.json');
const libraryName = 'loaderz';
export default {
input: `src/${libraryName}.ts`,
output: [
{ file: pkg.main, name: lodashCamelcase(libraryName), format: 'umd', sourcemap: true },
{ file: pkg.module, format: 'es', sourcemap: true },
],
watch: {
include: 'src/**',
},
plugins: [
// Allow json resolution
rollupPluginJson(),
// Compile TypeScript files
rollupPluginTypescript2({
useTsconfigDeclarationDir: true,
// By default we use `commonjs` in the `tsconfig`, we must use `es2015`
// or `esnext` when bundling the module
tsconfigOverride: {
compilerOptions: {
module: 'es2015',
},
},
}),
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
rollupPluginCommonjs(),
// Allow node_modules resolution, so you can use 'external' to control
// which external modules to include in the bundle
// https://github.com/rollup/rollup-plugin-node-resolve#usage
rollupPluginNodeResolve(),
// Resolve source maps to the original source
rollupPluginSourcemaps(),
],
};