Skip to content

Commit 87186bf

Browse files
committed
improve build file readme
1 parent 71ce60d commit 87186bf

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

dist/README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,38 @@
2020

2121
The difference between the browser build and the CommonJS build is that the latter preserves the `process.env.NODE_ENV` check for development/production modes (defaults to development mode). This gives you more control over what mode the code should run in:
2222

23-
- When bundling for the browser, you can turn on production mode by using Webpack's [DefinePlugin](https://webpack.github.io/docs/list-of-plugins.html#defineplugin) or Browserify's [envify](https://github.com/hughsk/envify) to replace `process.env.NODE_ENV` with the `"production"` string literal. This also allows minifiers to completely drop the warnings inside the conditional blocks. See [examples](http://vuejs.org/v2/guide/deployment.html).
23+
- When bundling for the browser, you can turn on production mode by using Webpack's [DefinePlugin](https://webpack.github.io/docs/list-of-plugins.html#defineplugin) to replace `process.env.NODE_ENV` with the `"production"` string literal:
24+
25+
``` js
26+
plugins: [
27+
new webpack.DefinePlugin({
28+
'process.env.NODE_ENV': '"production"'
29+
})
30+
]
31+
```
32+
33+
This also allows minifiers to completely drop the warnings inside the conditional blocks. For Browserify, you can use [envify](https://github.com/hughsk/envify) to achieve the same.
2434

2535
- When running Vue in Node.js (during server side rendering), Vue will pick up the actual `process.env.NODE_ENV` if set.
2636

2737
- ### vue.runtime.common.js
2838

29-
The runtime-only (compiler-excluded) CommonJS build. **This is the default build you get from `import Vue from 'vue'` or `var Vue = require('vue')`**.
39+
The runtime-only (compiler-excluded) CommonJS build.
3040

3141
This build does not support the `template` option, because it doesn't include the compiler. It is thus 30% lighter than the full build. However, you can still use templates in Single-File `*.vue` components via `vue-loader` or `vueify`, as these tools will pre-compile the templates into render functions for you.
3242
43+
**This is the default build you get from `import Vue from 'vue'` or `var Vue = require('vue')`**. To use the full CommonJS build instead, configure Webpack via the `resolve.alias` option:
44+
45+
``` js
46+
resolve: {
47+
alias: {
48+
vue$: 'vue/dist/vue.common.js'
49+
}
50+
}
51+
```
52+
53+
For Browserify, use the [aliasify](https://github.com/benbria/aliasify) transform.
54+
3355
- ### vue.runtime.js
3456
3557
The runtime-only (compiler-excluded) browser build. You can also include this build with a script tag, but with this build, you will **not** be able to use the `template` option. Hard-coded to development mode.

0 commit comments

Comments
 (0)