Last active
June 21, 2017 17:48
-
-
Save gund/50199dfcc29579605b3d56144977cf40 to your computer and use it in GitHub Desktop.
Rollup Angular configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Precompile angular module before server-side rendering | |
import typescript from 'rollup-plugin-typescript2'; | |
import angular from 'rollup-plugin-angular'; | |
import nodeResolve from 'rollup-plugin-node-resolve'; | |
import alias from 'rollup-plugin-alias'; | |
import { GLOBAL, globalsRegex } from 'rollup-globals-regex'; | |
export default { | |
entry: 'src/app/app.module.ts', | |
dest: 'dist-ngu/app.module.js', | |
format: 'cjs', | |
plugins: [ | |
angular(), | |
typescript(), | |
alias({ rxjs: __dirname + '/node_modules/rxjs-es' }), // rxjs fix (npm install rxjs-es) | |
nodeResolve({ jsnext: true, main: true }), | |
], | |
globals: globalsRegex({ | |
'tslib': 'tslib', | |
[GLOBAL.NG2]: GLOBAL.NG2.TPL, | |
[GLOBAL.RX]: GLOBAL.RX.TPL, | |
[GLOBAL.RX_OBSERVABLE]: GLOBAL.RX_OBSERVABLE.TPL, | |
[GLOBAL.RX_OPERATOR]: GLOBAL.RX_OPERATOR.TPL, | |
}), | |
external: (moduleId) => { | |
if (/^(\@angular|rxjs)\//.test(moduleId)) { | |
return true; | |
} | |
return false; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment