geelen / jspm-server

A live-reloading development server for JSPM
144 stars 12 forks source link

Improve the way we are marking modules as hot-reloadable #15

Open johnraz opened 9 years ago

johnraz commented 9 years ago

Follow-up of discussion going in #1, should go here :-)

Quoting @guybedford:

It could be worth allowing load metadata as an alternative way to indicate hot reloading as well (and that would also avoid the export * issue for hot reloadable modules as well if that causes problems down the line).

That would allow something like:

System.config({ meta: { '*.js': { hotReload: true } } });

Quoting @geelen:

That could be a great solution @guybedford. I think hot-reloading should be opt-in, but yeah, it would be good to not to have to specify it on each and every file...

geelen commented 9 years ago

Yeah, I just changed an IMG file and it reloaded my whole app. Which is totes dumb.

The config idea is a good one, but it seems like it should be auto-generated with some defaults. Maybe jspm-server maintains its own config with defaults like:

{
  '*.js': { hotReload: false },
  '*.html': { hotReload: false },
  '*.(png|jpe?g|gif)': { hotReload: () => false }
}

and then merges the one provided by the user?

guybedford commented 9 years ago

Sounds sensible. Meta configuration is additive so will compose well in this way.