Skip to content

Commit

Permalink
Merge pull request #145 from pizza2code/transform_option
Browse files Browse the repository at this point in the history
Babel transform option
  • Loading branch information
milankinen authored Jan 4, 2017
2 parents ca9d199 + 0d21d99 commit ef14222
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ Omits the reload client from the generated bundle.
Adds your custom SSL certificate and key to the reload web-server. This is needed if you
want to use LiveReactLoad in HTTPS site. Parameters are paths to the actual files.

#### `--no-babel`

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

## License

Expand Down
4 changes: 3 additions & 1 deletion src/browserify-plugin/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function LiveReactloadPlugin(b, opts = {}) {
const {
port = 4474,
host = null,
babel = true,
client = true,
dedupe = true,
debug = false,
Expand All @@ -33,7 +34,8 @@ function LiveReactloadPlugin(b, opts = {}) {
port: Number(port),
host: host,
clientEnabled: client,
debug: debug
debug: debug,
babel: babel
}

b.on("reset", addHooks)
Expand Down
19 changes: 11 additions & 8 deletions src/reloading.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,17 @@ function loader(mappings, entryPoints, options) {

// prepare mappings before starting the app
forEachValue(scope.mappings, compile);
if (isReactTransformEnabled(scope.mappings)) {
info("LiveReactLoad transform detected. Ready to rock!");
} else {
warn(
"Could not detect LiveReactLoad transform (livereactload/babel-transform). " +
"Please see instructions how to setup the transform:\n\n" +
"https://github.com/milankinen/livereactload#installation"
);

if (options.babel) {
if (isReactTransformEnabled(scope.mappings)) {
info("LiveReactLoad Babel transform detected. Ready to rock!");
} else {
warn(
"Could not detect LiveReactLoad transform (livereactload/babel-transform). " +
"Please see instructions how to setup the transform:\n\n" +
"https://github.com/milankinen/livereactload#installation"
);
}
}

scope.compile = compile;
Expand Down

0 comments on commit ef14222

Please sign in to comment.