Skip to content

Commit

Permalink
Add --moduledir plugin option
Browse files Browse the repository at this point in the history
  • Loading branch information
milankinen committed Dec 3, 2018
1 parent 421186b commit 67859d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and it is already available in npm as a beta tag. If you want to test it, check
installation instructions [here](https://github.com/milankinen/livereactload/tree/4.x)!**

:exclamation: :exclamation: :exclamation:


[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/milankinen/livereactload)
[![npm version](https://badge.fury.io/js/livereactload.svg)](http://badge.fury.io/js/livereactload)
Expand Down Expand Up @@ -186,24 +186,24 @@ about config format).

LiveReactload supports the following configuration options

#### `--no-server`
#### `--no-server`

Prevents reload server startup. If you are using LiveReactload plugin with Browserify
Prevents reload server startup. If you are using LiveReactload plugin with Browserify
(instead of watchify), you may want to enable this so that the process won't hang after
bundling. This is not set by default.

#### `--port <number>`
#### `--port <number>`

Starts reload server to the given port and configures the bundle's client to
Starts reload server to the given port and configures the bundle's client to
connect to the server using this port. Default value is `4474`

#### `--host <hostname>`

Configures the reload client to use the given hostname when connecting to the
reload server. You may need this if you are running the bundle in an another device.
reload server. You may need this if you are running the bundle in an another device.
Default value is `localhost`

#### `--no-dedupe`
#### `--no-dedupe`

Disables Browserify module de-duplication. By default, de-duplication is enabled.
However, sometimes this de-duplication with may cause an invalid bundle with LiveReactload.
Expand All @@ -222,6 +222,10 @@ want to use LiveReactLoad in HTTPS site. Parameters are paths to the actual file

If you use a tool other than Babel to transform React syntax, this disables the in-browser warning that would otherwise appear.

#### `--moduledir <node_modules>`

Directory pointing node modules where `livereactload` is installed. By default points to `<root-dir>/node_modules`.

## License

MIT
Expand Down
10 changes: 5 additions & 5 deletions src/browserify-plugin/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ function LiveReactloadPlugin(b, opts = {}) {
client = true,
dedupe = true,
debug = false,
basedir = process.cwd(),
'ssl-cert': sslCert = null,
'ssl-key': sslKey = null,
} = opts
moduledir = null,
"ssl-cert": sslCert = null,
"ssl-key": sslKey = null
} = opts;

// server is alive as long as watchify is running
const server = opts.server !== false ? startServer({port: Number(port), sslCert, sslKey}) : null

const clientOpts = {
// assuming that livereload package is in global mdule directory (node_modules)
// and this file is in ./lib/babel-plugin folder
nodeModulesRoot: resolve(__dirname, "../../.."),
nodeModulesRoot: moduledir || resolve(__dirname, "../../.."),
port: Number(port),
host: host,
clientEnabled: client,
Expand Down

0 comments on commit 67859d5

Please sign in to comment.