Skip to content

Commit deab5a3

Browse files
zigomirchrisvfritz
authored andcommitted
vueify@next needs global envify (#357)
With browserify & Vue 2.0 you actually need to install `envify` yourself and apply it as global transform like [described here](https://github.com/vuejs/vueify/tree/next#building-for-production-1). There's also now extract-css plugin included now.
1 parent cc6b4c2 commit deab5a3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/guide/single-file-components.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,16 @@ module.exports = {
8181

8282
### Browserify
8383

84-
Just run your bundling command with `NODE_ENV` set to `"production"`. Vue automatically applies [envify](https://github.com/hughsk/envify) transform to itself and makes warning blocks unreachable. For example:
84+
- Run your bundling command with `NODE_ENV` set to `"production"`. This tells `vueify` to avoid including hot-reload and development related code.
85+
- Apply a global [envify](https://github.com/hughsk/envify) transform to your bundle. This allows the minifier to strip out all the warnings in Vue's source code wrapped in env variable conditional blocks. For example:
86+
87+
88+
``` bash
89+
NODE_ENV=production browserify -g envify -e main.js | uglifyjs -c -m > build.js
90+
```
91+
92+
- To extract styles to a separate css file use a extract-css plugin which is included in vueify.
8593

8694
``` bash
87-
NODE_ENV=production browserify -e main.js | uglifyjs -c -m > build.js
95+
NODE_ENV=production browserify -g envify -p [ vueify/plugins/extract-css -o build.css ] -e main.js | uglifyjs -c -m > build.js
8896
```

0 commit comments

Comments
 (0)