Skip to content

Commit 8b61b75

Browse files
authored
Merge branch 'master' into fixed-sidebar
2 parents 272efa6 + 32c176e commit 8b61b75

File tree

9 files changed

+7238
-9
lines changed

9 files changed

+7238
-9
lines changed

.travis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ node_js:
88
script:
99
- bash ./scripts/deploy.sh
1010
sudo: required
11+
cache: yarn
1112
install:
12-
- npm install
13+
- npm i yarn -g
14+
- yarn
1315
- sudo pip install proselint

bootstrap.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ antwar[environment]({
1111
webpack: require('./webpack.config')
1212
}).catch(function (err) {
1313
console.error(err);
14+
15+
process.exit(1);
1416
});

content/concepts/output.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ For more information on cross-origin loading see [MDN](https://developer.mozilla
6464

6565
> Default: `false`
6666
67-
> see also [[library and externals]]
67+
> see also [library](/guides/author-libraries/)
6868
69-
> see also [[Development Tools]]
69+
> see also [Development Tools](/guides/development/#choosing-a-tool)
7070
7171
### `output.devtoolLineToLine`
7272

content/development/how-to-write-a-loader.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This function is called when a resource should be transformed by this loader.
99

1010
In the simple case, when only a single loader is applied to the resource, the loader is called with one parameter: the content of the resource file as string.
1111

12-
The loader can access the [[loader API | loaders]] on the `this` context in the function.
12+
The loader can access the [loader API](api/loaders/) on the `this` context in the function.
1313

1414
A sync loader that only wants to give a one value can simply `return` it. In every other case the loader can give back any number of values with the `this.callback(err, values...)` function. Errors are passed to the `this.callback` function or thrown in a sync loader.
1515

content/development/how-to-write-a-plugin.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ These two components are an integral part of any webpack plugin (especially a `c
2020

2121
## Basic plugin architecture
2222

23-
Plugins are instanceable objects with an `apply` method on their prototype. This `apply` method is called once by the webpack compiler while installing the plugin. The `apply` method is given a reference to the underlying webpack compiler, which grants access to compiler callbacks. A simple plugin is structured as follows:
23+
24+
Plugins are instantiated objects with an `apply` method on their prototype. This `apply` method is called once by the Webpack compiler while installing the plugin. The `apply` method is given a reference to the underlying Webpack compiler, which grants access to compiler callbacks. A simple plugin is structured as follows:
2425

2526
```javascript
2627
function HelloWorldPlugin(options) {
@@ -71,7 +72,7 @@ HelloCompilationPlugin.prototype.apply = function(compiler) {
7172
module.exports = HelloCompilationPlugin;
7273
```
7374

74-
For more information on what callbacks are available on the `compiler`, `compilation`, and other important objects, see the [[plugins API|plugins]] doc.
75+
For more information on what callbacks are available on the `compiler`, `compilation`, and other important objects, see the [plugins](/api/plugins/) doc.
7576

7677
## Async compilation plugins
7778

content/guides/build-performance.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ sort: 15
1212
> resolving
1313
> DllPlugin
1414
15-
> see also [[development tools]]
16-
> see also [[resolving]]
15+
[Development Tools](/guides/development/#choosing-a-tool)
16+
17+
> see also [resolving](/concepts/module-resolution/#resolving-rules-in-webpack)

content/guides/code-splitting-libraries.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ contributors:
55
- pksjce
66
- chrisVillanueva
77
- johnstew
8+
- rafde
89
---
910

1011
A typical application uses third party libraries for framework/functionality needs. Particular versions of these libraries are used and code here does not change often. However, the application code changes frequently.
@@ -109,6 +110,38 @@ module.exports = function(env) {
109110
```
110111
Now run `webpack` on your application. Bundle inspection shows that `moment` code is present only in the vendor bundle.
111112

113+
## Implicit Common Vendor Chunk
114+
115+
You can configure a `CommonsChunkPlugin` instance to only accept vendor libraries.
116+
117+
__webpack.config.js__
118+
119+
```javascript
120+
var webpack = require('webpack');
121+
var path = require('path');
122+
123+
module.exports = function() {
124+
return {
125+
entry: {
126+
main: './index.js'
127+
},
128+
output: {
129+
filename: '[chunkhash].[name].js',
130+
path: path.resolve(__dirname, 'dist')
131+
},
132+
plugins: [
133+
new webpack.optimize.CommonsChunkPlugin({
134+
name: 'vendor',
135+
minChunks: function (module) {
136+
// this assumes your vendor imports exist in the node_modules directory
137+
return module.context && module.context.indexOf('node_modules') !== -1;
138+
}
139+
})
140+
]
141+
};
142+
}
143+
```
144+
112145
## Manifest File
113146

114147
But, if we change application code and run `webpack` again, we see that the hash for the vendor file changes. Even though we achieved separate bundles for `vendor` and `main` bundles, we see that the `vendor` bundle changes when the application code changes.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
"d3": "^4.2.7",
9999
"filesize": "^3.3.0",
100100
"preact": "^6.2.1",
101-
"preact-compat": "^3.6.0",
101+
"preact-compat": "3.11.0",
102102
"react": "^15.3.2",
103103
"react-dom": "^15.3.2",
104104
"react-router": "^2.8.1",

0 commit comments

Comments
 (0)