0.0.1-security • Published 7 months ago

rollup-plugin-hotreload v0.0.1-security

Weekly downloads
4
License
-
Repository
-
Last release
7 months ago

rollup-plugin-hotreload

Hot Reload plugin for Rollup.js

npm.io Coverage Status

Feature

  • Multiple files hotreload supported
  • Auto injected into HTML supported
  • EventSource (depended on browsers)

How to use

NOTE: the rollup-plugin-hotreload server port is 9999

:DO NOT USE localhost server port as the same as 9999

rollup.config.js

import { rph, rphMultibundles } from "rollup-plugin-hotreload";
import path from "path";
import "your_server_path"; // import your server path;

export default rphMultibundles({
  //...
  plugins: [
    rph({
      templateHtmlPath: "src/index.html", // template html path relative to rootDir
      isStopRPH: false, // stop hotreload or not
      rootDir: __dirname, // rootDir
      rootBuildDir: "build", // build root path relative to rootDir
      buildPaths: [
        // first one is relative path to rootDir...
        ["js/index.min.js", "src/index.js"]
        // as many as you want ...
      ]
    })
  ]
});

your_server.js

// koa@2.6.2
import Koa from 'koa';
import koaSend from 'koa-send';
const server = new Koa();

server.use(async ctx => {
  await koaSend(ctx, ctx.path, {
    root: __dirname + '/build'
  });
});

server.listen(3005);

export default server;

Installation

  • NPM
$npm install rollup-plugin-hotreload --save-dev
  • CDN
<script src="https://unpkg.com/rollup-plugin-hotreload">

Test

$npm run test

Build

$npm run build

ChangeLog

Contributing

Feel free to fork and PR

Issues

License

MIT

0.0.1-security

7 months ago

6.5.8

8 months ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.6

6 years ago

2.2.5

6 years ago

2.2.4

7 years ago

2.2.3

7 years ago

2.2.2

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.9

7 years ago

2.1.8

7 years ago

2.1.7

7 years ago

2.1.6

7 years ago

2.1.5

7 years ago

2.1.3

7 years ago

2.1.2

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.4

7 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago