Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Babel transform option #145

Merged
merged 3 commits into from
Jan 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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