tsbundle/rollup.config.js

58 lines
1.6 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-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 09:22:59 +00:00
name: 'tsbundle',
// file: 'dist_web/bundle.js',
2019-04-30 08:55:43 +00:00
file: 'dist_web/bundle.js',
2019-04-30 09:22:59 +00:00
format: 'iife',
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 10:49:10 +00:00
// 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(),
2019-04-30 08:39:54 +00:00
commonjs({
namedExports: {
2019-04-30 08:54:03 +00:00
'node_modules/@pushrocks/smartstate/dist/index.js': ['Smartstate']
2019-04-30 08:39:54 +00:00
}
}),
2019-04-29 20:11:24 +00:00
// Resolve source maps to the original source
sourceMaps(),
2019-04-30 09:22:59 +00:00
babel({
extensions: ['.js', '.jsx', '.ts', '.tsx'],
babelrc: false,
2019-04-30 09:37:05 +00:00
presets: [["@babel/preset-env", { modules: false }]]
2019-04-30 09:22:59 +00:00
})
2019-04-30 07:44:46 +00:00
]
};