Skip to content

FuseBox Loader Plugin which do livereload on demand.

Notifications You must be signed in to change notification settings

unlight/fusebox-reload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fusebox-reload

FuseBox Loader Plugin which do livereload on demand.

INSTALL

npm i -D fusebox-reload

USAGE

In your first entry point (usualy main.js) add something like:
// @if devMode
import 'fusebox-reload';
// @endif

Or:

if (process.env.NODE_ENV === 'development') {
    require('fusebox-reload');
}
In your task runner, do something like:
const ds = fuseBox({ config }).devServer(`>main.ts`, {
    port: config.socketPort,
    httpServer: false,
    emitter: (self, fileInfo) => {
        if (fileInfo.path === 'index.html') {
            setTimeout(() => self.socketServer.send('source-changed', {type: 'reload'}), 200);
        } else {
            self.socketServer.send('source-changed', fileInfo);
        }
    }
});

Or:

ds.socketServer.send('source-changed', {type: 'reload'});

About

FuseBox Loader Plugin which do livereload on demand.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published