rebundle when files are created/renamed

pull/2248/head
Richard Harris 6 years ago
parent 81d33a2fb0
commit 52dac8f2a7

@ -5,7 +5,7 @@
export let handle_select;
const { components, selected, request_focus } = getContext('REPL');
const { components, selected, request_focus, rebundle } = getContext('REPL');
let editing = null;
@ -35,6 +35,8 @@
// focus the editor, but wait a beat (so key events aren't misdirected)
setTimeout(request_focus);
rebundle();
}
function remove(component) {

@ -59,11 +59,17 @@
let module_editor;
let output;
function rebundle() {
workers.bundler.postMessage({ type: 'bundle', components: $components });
}
setContext('REPL', {
components,
selected,
bundle,
rebundle,
navigate: item => {
const match = /^(.+)\.(\w+)$/.exec(item.filename);
if (!match) return; // ???
@ -93,8 +99,7 @@
// recompile selected component
output.update($selected);
// regenerate bundle (TODO do this in a separate worker?)
workers.bundler.postMessage({ type: 'bundle', components: $components });
rebundle();
dispatch('change', {
components: $components

Loading…
Cancel
Save