From 7cbf5883098d5b87a6cc7bf35d670eb6d2b68949 Mon Sep 17 00:00:00 2001 From: zigomir Date: Wed, 29 Jun 2016 23:45:05 -0700 Subject: [PATCH 1/2] babel is only one option. still default if installed. --- README.md | 4 ++-- lib/compiler.js | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index da918e0..53ad0a8 100644 --- a/README.md +++ b/README.md @@ -121,9 +121,9 @@ Make sure to have the `NODE_ENV` environment variable set to `"production"` when If you are using Gulp, note that `gulp --production` **does not** affect vueify; you still need to explicitly set `NODE_ENV=production`. -## ES2015 by Default +## ES2015 when `babel-core` installed -Vueify automatically transforms the JavaScript in your `*.vue` components using Babel. Write ES2015 today! +Vueify automatically transforms the JavaScript in your `*.vue` components using Babel when it is installed. Write ES2015 today! The default Babel (6) options used for Vue.js components are: diff --git a/lib/compiler.js b/lib/compiler.js index 09bb491..293eca7 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -22,6 +22,13 @@ try { hotReloadAPIPath = 'vueify/node_modules/vue-hot-reload-api' } +var hasBabel = true +try { + require('babel-core') +} catch (e) { + hasBabel = false +} + var htmlMinifyOptions = { collapseWhitespace: true, removeComments: true, @@ -291,7 +298,8 @@ function processStyle (node, filePath, id) { */ function processScript (node, filePath, content) { - var lang = checkLang(node) || 'babel' + var lang = checkLang(node) || (hasBabel ? 'babel' : null) + var script = checkSrc(node, filePath) if (!script) { script = parse5.serialize(node) From 8905a50bbac8ac38de519aed54c4d07f2201dab9 Mon Sep 17 00:00:00 2001 From: zigomir Date: Thu, 30 Jun 2016 07:59:49 -0700 Subject: [PATCH 2/2] Another remark. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 53ad0a8..5a1f711 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ npm install vueify --save-dev browserify -t vueify -e src/main.js -o build/build.js ``` -If you are using npm 3+, it no longer auto install the peer dependencies. So you will also have to also install the babel-related dependencies: +If you are using npm 3+ and **babel**, it no longer auto install the peer dependencies. So you will also have to also install the babel-related dependencies: ``` bash npm install\