rollup cache is not invalidated when external templates or styles are edited
robianmcd opened this issue · 3 comments
If I enable rollup's cache
option then changes to html files and css files will be ignored until their component is edited. e.g. with the following gulpfile
var gulp = require('gulp');
var rollup = require('rollup').rollup;
var angular = require('rollup-plugin-angular');
var typescript = require('rollup-plugin-typescript');
var nodeResolve = require('rollup-plugin-node-resolve');
var commonjs = require('rollup-plugin-commonjs');
var rollUpBundle;
gulp.task('rollup', function () {
var rollupConfig = {
entry: 'src/app.component.ts',
cache: rollUpBundle,
plugins: [
angular(),
typescript(),
nodeResolve({ jsnext: true, main: true }),
commonjs({include: 'node_modules/rxjs/**'})]
};
return rollup(rollupConfig)
.then(function (bundle) {
rollUpBundle = bundle;
return bundle.write({
format: 'iife',
dest: 'dist/app.js'
});
});
});
gulp.task('default', ['rollup'], function () {
gulp.watch('src/**', ['rollup']);
});
and the following component
import {Component} from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: 'app.component.html'
})
class AppComponent {
}
editing app.component.html
will not change the bundle that rollup outputs.
Attached is a minimal app that reproduces the issue
rollup-angular.zip
Reproduce by running
npm install
gulp
edit app.component.html
and note that the changes are not added to the app.js
bundle unless you edit app.component.ts
Yes, you are right. I don't know the the rollup plugin system very well, to achieve this.
It's just a port of https://github.com/TheLarkInn/angular2-template-loader.
But feel free to create a PR.
I took a look at how caching works in rollup and I'm not sure if it is possible for a plugin like this to invalidate the cache when it needs to. I opened an issue on Rollup to get some input