tsbundle/rollup.config.js

51 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-04-30 07:44:46 +00:00
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import sourceMaps from 'rollup-plugin-sourcemaps';
import typescript from 'rollup-plugin-typescript2';
import json from 'rollup-plugin-json';
import babel from 'rollup-plugin-babel';
2019-04-30 08:28:00 +00:00
import nodeResolve from 'rollup-plugin-node-resolve';
2019-04-29 20:11:24 +00:00
2019-04-30 07:44:46 +00:00
const pkg = require('./package.json');
2019-04-29 20:11:24 +00:00
export default {
2019-04-30 06:42:55 +00:00
input: `ts_web/index.ts`,
2019-04-29 20:11:24 +00:00
output: {
2019-04-30 07:44:46 +00:00
file: 'dist/bundle.js',
2019-04-29 20:11:24 +00:00
format: 'es',
2019-04-30 07:44:46 +00:00
sourcemap: true
},
2019-04-29 20:11:24 +00:00
// Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
external: [],
watch: {
2019-04-30 07:44:46 +00:00
include: 'src/**'
2019-04-29 20:11:24 +00:00
},
plugins: [
// Allow json resolution
json(),
// Compile TypeScript files
2019-04-30 08:01:23 +00:00
typescript({ useTsconfigDeclarationDir: true, tsconfigOverride: {
compilerOptions: {
declaration: true,
emitDecoratorMetadata: true,
experimentalDecorators: true,
inlineSourceMap: true,
noEmitOnError: true,
lib: ['es2016', 'es2017', 'dom'],
noImplicitAny: false
}
} }),
2019-04-30 08:28:00 +00:00
nodeResolve(),
2019-04-29 20:11:24 +00:00
// Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
commonjs(),
// 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
resolve(),
// Resolve source maps to the original source
sourceMaps(),
babel()
2019-04-30 07:44:46 +00:00
]
};