Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

Commit f38f00f

Browse files
zigomiryyx990803
authored andcommitted
babel is only one option. (#105)
* babel is only one option. still default if installed. * Another remark.
1 parent 184b906 commit f38f00f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ npm install vueify --save-dev
6767
browserify -t vueify -e src/main.js -o build/build.js
6868
```
6969

70-
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:
70+
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:
7171

7272
``` bash
7373
npm install\
@@ -121,9 +121,9 @@ Make sure to have the `NODE_ENV` environment variable set to `"production"` when
121121

122122
If you are using Gulp, note that `gulp --production` **does not** affect vueify; you still need to explicitly set `NODE_ENV=production`.
123123

124-
## ES2015 by Default
124+
## ES2015 when `babel-core` installed
125125

126-
Vueify automatically transforms the JavaScript in your `*.vue` components using Babel. Write ES2015 today!
126+
Vueify automatically transforms the JavaScript in your `*.vue` components using Babel when it is installed. Write ES2015 today!
127127

128128
The default Babel (6) options used for Vue.js components are:
129129

lib/compiler.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ try {
2222
hotReloadAPIPath = 'vueify/node_modules/vue-hot-reload-api'
2323
}
2424

25+
var hasBabel = true
26+
try {
27+
require('babel-core')
28+
} catch (e) {
29+
hasBabel = false
30+
}
31+
2532
var htmlMinifyOptions = {
2633
collapseWhitespace: true,
2734
removeComments: true,
@@ -291,7 +298,8 @@ function processStyle (node, filePath, id) {
291298
*/
292299

293300
function processScript (node, filePath, content) {
294-
var lang = checkLang(node) || 'babel'
301+
var lang = checkLang(node) || (hasBabel ? 'babel' : null)
302+
295303
var script = checkSrc(node, filePath)
296304
if (!script) {
297305
script = parse5.serialize(node)

0 commit comments

Comments
 (0)