From b43bbcb0f2e3fb4cb391349b02c03b1fe110c4d9 Mon Sep 17 00:00:00 2001 From: pizza2code Date: Tue, 3 Jan 2017 17:12:18 +0000 Subject: [PATCH 1/4] add option to disable React transform warning --- README.md | 3 +++ src/browserify-plugin/main.js | 4 +++- src/reloading.js | 18 ++++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 76898ab..ed459f5 100644 --- a/README.md +++ b/README.md @@ -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-transform` + +Disables a warning when livereactload's Babel transform is not being used. Only enable this option if another process transforms React syntax prior to bundling! ## License diff --git a/src/browserify-plugin/main.js b/src/browserify-plugin/main.js index 97d8217..de3b865 100644 --- a/src/browserify-plugin/main.js +++ b/src/browserify-plugin/main.js @@ -18,6 +18,7 @@ function LiveReactloadPlugin(b, opts = {}) { client = true, dedupe = true, debug = false, + transform = true, basedir = process.cwd(), 'ssl-cert': sslCert = null, 'ssl-key': sslKey = null, @@ -33,7 +34,8 @@ function LiveReactloadPlugin(b, opts = {}) { port: Number(port), host: host, clientEnabled: client, - debug: debug + debug: debug, + transform: transform } b.on("reset", addHooks) diff --git a/src/reloading.js b/src/reloading.js index 1c19fda..0753362 100644 --- a/src/reloading.js +++ b/src/reloading.js @@ -349,14 +349,16 @@ 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.transform) { + 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" + ); + } } scope.compile = compile; From 387d2bc558b3392b42d3d5ce894066789cb2c691 Mon Sep 17 00:00:00 2001 From: pizza2code Date: Tue, 3 Jan 2017 21:46:21 +0000 Subject: [PATCH 2/4] change --no-transform to --no-babel --- README.md | 4 ++-- src/browserify-plugin/main.js | 4 ++-- src/reloading.js | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ed459f5..b101b3e 100644 --- a/README.md +++ b/README.md @@ -211,9 +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-transform` +#### `--no-babel` -Disables a warning when livereactload's Babel transform is not being used. Only enable this option if another process transforms React syntax prior to bundling! +If you use a tool other than Babel to transform React syntax, this disables the in-browser warning that would otherwise appear. ## License diff --git a/src/browserify-plugin/main.js b/src/browserify-plugin/main.js index de3b865..71d8588 100644 --- a/src/browserify-plugin/main.js +++ b/src/browserify-plugin/main.js @@ -15,10 +15,10 @@ function LiveReactloadPlugin(b, opts = {}) { const { port = 4474, host = null, + babel = true, client = true, dedupe = true, debug = false, - transform = true, basedir = process.cwd(), 'ssl-cert': sslCert = null, 'ssl-key': sslKey = null, @@ -35,7 +35,7 @@ function LiveReactloadPlugin(b, opts = {}) { host: host, clientEnabled: client, debug: debug, - transform: transform + babel: babel } b.on("reset", addHooks) diff --git a/src/reloading.js b/src/reloading.js index 0753362..55a6c51 100644 --- a/src/reloading.js +++ b/src/reloading.js @@ -349,9 +349,10 @@ function loader(mappings, entryPoints, options) { // prepare mappings before starting the app forEachValue(scope.mappings, compile); - if (options.transform) { + + if (options.babel) { if (isReactTransformEnabled(scope.mappings)) { - info("LiveReactLoad transform detected. Ready to rock!"); + info("LiveReactLoad Babel transform detected. Ready to rock!"); } else { warn( "Could not detect LiveReactLoad transform (livereactload/babel-transform). " + From 0d21d99e859c98b80b945117426df638e4fc613b Mon Sep 17 00:00:00 2001 From: pizza2code Date: Tue, 3 Jan 2017 22:20:21 +0000 Subject: [PATCH 3/4] tabs to spaces --- src/browserify-plugin/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/browserify-plugin/main.js b/src/browserify-plugin/main.js index 71d8588..e2a52e8 100644 --- a/src/browserify-plugin/main.js +++ b/src/browserify-plugin/main.js @@ -15,7 +15,7 @@ function LiveReactloadPlugin(b, opts = {}) { const { port = 4474, host = null, - babel = true, + babel = true, client = true, dedupe = true, debug = false, @@ -35,7 +35,7 @@ function LiveReactloadPlugin(b, opts = {}) { host: host, clientEnabled: client, debug: debug, - babel: babel + babel: babel } b.on("reset", addHooks) From d5119b53af90ff5f36d13646d771c8ef486a477a Mon Sep 17 00:00:00 2001 From: Matti Lankinen Date: Wed, 4 Jan 2017 12:44:10 +0200 Subject: [PATCH 4/4] Version 3.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4021e9d..a7f546c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "livereactload", - "version": "3.1.2", + "version": "3.2.0", "description": "Live code editing with Browserify and React", "author": "Matti Lankinen (https://github.com/milankinen)", "license": "MIT",