Created
October 4, 2017 15:17
-
-
Save hartraft/554654e9481c13941deefdcc2dab7386 to your computer and use it in GitHub Desktop.
rollup.config.js with typescript and node module , angular templateUrl / styleUrl resolution & SASS processing. Line 23-28 resolves the templateUrl / styleUrl in angular components
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
// rollup.config.js with typescript and node module , angular templateUrl / styleUrl resolution & SASS processing | |
import angular from 'rollup-plugin-angular'; | |
import typescript from 'rollup-plugin-typescript'; | |
import nodeResolve from 'rollup-plugin-node-resolve'; | |
import sass from 'node-sass'; | |
export default { | |
entry: 'dist/index.js', | |
dest: 'dist/bundles/amazing.umd.js', | |
sourceMap: false, | |
format: 'umd', | |
moduleName: 'ng.amazing', | |
globals: { | |
'@angular/core': 'ng.core', | |
'rxjs/Observable': 'Rx', | |
'rxjs/ReplaySubject': 'Rx', | |
'rxjs/add/operator/map': 'Rx.Observable.prototype', | |
'rxjs/add/operator/mergeMap': 'Rx.Observable.prototype', | |
'rxjs/add/observable/fromEvent': 'Rx.Observable', | |
'rxjs/add/observable/of': 'Rx.Observable' | |
}, | |
plugins: [ | |
angular( | |
{ | |
preprocessors:{ | |
template:template => template, | |
style: scss => { | |
let css; | |
if(scss){ | |
css = sass.renderSync({ data: scss }).css.toString(); | |
}else{ | |
css = ''; | |
} | |
return css; | |
}, | |
} | |
} | |
), | |
typescript({ | |
typescript:require('typescript') | |
}), | |
resolve({module: true, main: true}), | |
commonjs({ | |
include: 'node_modules/**', | |
}) | |
], | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment