Skip to content

Instantly share code, notes, and snippets.

@gund
Last active June 21, 2017 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gund/50199dfcc29579605b3d56144977cf40 to your computer and use it in GitHub Desktop.
Save gund/50199dfcc29579605b3d56144977cf40 to your computer and use it in GitHub Desktop.
Rollup Angular configuration
// 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