Skip to content

Commit 7fb1cd8

Browse files
committed
docs: remove webpack 1 reference, refer new cli
1 parent a438118 commit 7fb1cd8

File tree

10 files changed

+44
-289
lines changed

10 files changed

+44
-289
lines changed

docs/en/configurations/advanced.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ To do that, specify the `loaders` option for `vue-loader`:
1212

1313
> Note that `preLoaders` and `postLoaders` are only supported in 10.3.0+
1414
15-
### webpack 2.x
16-
1715
``` js
1816
module.exports = {
1917
// other options...
@@ -59,27 +57,4 @@ module.exports = {
5957
}
6058
```
6159

62-
### webpack 1.x
63-
64-
``` js
65-
// webpack.config.js
66-
module.exports = {
67-
// other options...
68-
module: {
69-
loaders: [
70-
{
71-
test: /\.vue$/,
72-
loader: 'vue'
73-
}
74-
]
75-
},
76-
// `vue-loader` configurations
77-
vue: {
78-
loaders: {
79-
// same configuration rules as above
80-
}
81-
}
82-
}
83-
```
84-
8560
A more practical usage of the advanced loader configuration is [extracting CSS inside components into a single file](./extract-css.md).

docs/en/configurations/custom-blocks.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ comp-a h2 {
4141
#### webpack.config.js
4242

4343
``` js
44-
// webpack 2.x
4544
var ExtractTextPlugin = require("extract-text-webpack-plugin")
4645

4746
module.exports = {

docs/en/configurations/extract-css.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ Note this only extracts `*.vue` files though - CSS imported in JavaScript still
3939

4040
Example config to extract all the processed CSS in all Vue components into a single CSS file:
4141

42-
### webpack 2.x
43-
44-
4542
``` js
4643
// webpack.config.js
4744
var ExtractTextPlugin = require("extract-text-webpack-plugin")
@@ -69,36 +66,3 @@ module.exports = {
6966
]
7067
}
7168
```
72-
73-
### webpack 1.x
74-
75-
``` bash
76-
npm install extract-text-webpack-plugin --save-dev
77-
```
78-
79-
``` js
80-
// webpack.config.js
81-
var ExtractTextPlugin = require("extract-text-webpack-plugin")
82-
83-
module.exports = {
84-
// other options...
85-
module: {
86-
loaders: [
87-
{
88-
test: /\.vue$/,
89-
loader: 'vue'
90-
},
91-
]
92-
},
93-
vue: {
94-
loaders: {
95-
css: ExtractTextPlugin.extract("css"),
96-
// you can also include <style lang="less"> or other langauges
97-
less: ExtractTextPlugin.extract("css!less")
98-
}
99-
},
100-
plugins: [
101-
new ExtractTextPlugin("style.css")
102-
]
103-
}
104-
```

docs/en/features/css-modules.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,6 @@ CSS Modules are processed via [css-loader](https://github.com/webpack/css-loader
8989
You can use vue-loader's `cssModules` option to provide additional query options to `css-loader`:
9090

9191
``` js
92-
// webpack 1
93-
vue: {
94-
cssModules: {
95-
// overwrite local ident name
96-
localIdentName: '[path][name]---[local]---[hash:base64:5]',
97-
// enable camelCase
98-
camelCase: true
99-
}
100-
}
101-
102-
// webpack 2
10392
module: {
10493
rules: [
10594
{

docs/en/features/postcss.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,7 @@ Sometimes the user may want to use `lang="postcss"` only for syntax highlighting
2727

2828
Alternatively, you can specify PostCSS config specifically for `*.vue` files using the `postcss` option for `vue-loader`.
2929

30-
Example usage in webpack 1.x:
31-
32-
``` js
33-
// webpack.config.js
34-
module.exports = {
35-
// other configs...
36-
vue: {
37-
// use custom PostCSS plugins
38-
postcss: [require('postcss-cssnext')()]
39-
}
40-
}
41-
```
42-
43-
For webpack 2.x:
30+
Example:
4431

4532
``` js
4633
// webpack.config.js

docs/en/options.md

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Options Reference
22

3-
## Usage Difference Between webpack 1 & 2
4-
5-
For webpack 2: pass the options directly to the loader rule.
3+
## Where to Place the Options
64

75
``` js
6+
// webpack.config.js
87
module.exports = {
98
// ...
109
module: {
@@ -21,20 +20,9 @@ module.exports = {
2120
}
2221
```
2322

24-
For webpack 1.x: add a root `vue` block in your webpack config.
25-
26-
``` js
27-
module.exports = {
28-
// ...
29-
vue: {
30-
// `vue-loader` options
31-
}
32-
}
33-
```
34-
3523
### loaders
3624

37-
- type: `{ [lang: string]: string }`
25+
- type: `{ [lang: string]: string | Object | Array }`
3826

3927
An object specifying webpack loaders to overwrite the default loaders used for language blocks inside `*.vue` files. The key corresponds to the `lang` attribute for language blocks, if specified. The default `lang` for each type is:
4028

@@ -45,7 +33,6 @@ module.exports = {
4533
For example, to use `babel-loader` and `eslint-loader` to process all `<script>` blocks:
4634

4735
``` js
48-
// webpack 2.x config
4936
module: {
5037
rules: [
5138
{
@@ -61,17 +48,36 @@ module.exports = {
6148
}
6249
```
6350

51+
You can also use object or array syntax (note the options must be serializable):
52+
53+
``` js
54+
module: {
55+
rules: [
56+
{
57+
test: /\.vue$/,
58+
loader: 'vue-loader',
59+
options: {
60+
loaders: {
61+
js: [
62+
{ loader: 'cache-loader' },
63+
{ loader: 'babel-loader', options: { presets: ['env'] } }
64+
]
65+
}
66+
}
67+
}
68+
]
69+
}
70+
```
71+
6472
### preLoaders
6573

6674
- type: `{ [lang: string]: string }`
67-
- only supported in 10.3.0+
6875

6976
The config format is the same as `loaders`, but `preLoaders` are applied to corresponding language blocks before the default loaders. You can use this to pre-process language blocks - a common use case would be build-time i18n.
7077

7178
### postLoaders
7279

7380
- type: `{ [lang: string]: string }`
74-
- only supported in 10.3.0+
7581

7682
The config format is the same as `loaders`, but `postLoaders` are applied after the default loaders. You can use this to post-process language blocks. However note that this is a bit more complicated:
7783

@@ -81,7 +87,7 @@ module.exports = {
8187

8288
### postcss
8389

84-
> Note: in 11.0.0+ it is recommended to use a PostCSS config file instead. [The usage is the same as `postcss-loader`](https://github.com/postcss/postcss-loader#usage).
90+
> Note: It is recommended to use a PostCSS config file instead so that your styles in vue files and normal CSS can share the same config. [The usage is the same as `postcss-loader`](https://github.com/postcss/postcss-loader#usage).
8591
8692
- type: `Array` or `Function` or `Object`
8793

@@ -208,21 +214,6 @@ module.exports = {
208214
Example configuration:
209215

210216
``` js
211-
// webpack 1
212-
vue: {
213-
buble: {
214-
// enable object spread operator
215-
// NOTE: you need to provide Object.assign polyfill yourself!
216-
objectAssign: 'Object.assign',
217-
218-
// turn off the `with` removal
219-
transforms: {
220-
stripWith: false
221-
}
222-
}
223-
}
224-
225-
// webpack 2
226217
module: {
227218
rules: [
228219
{

docs/en/start/setup.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# Setting Up a Project
22

3-
### Using `vue-cli`
3+
### Using `@vue/cli`
44

5-
It's recommended to scaffold a project using `vue-loader` with `vue-cli`:
5+
It's recommended to scaffold a project using `vue-loader` with `@vue/cli`:
66

77
``` bash
8-
npm install -g vue-cli
9-
vue init webpack-simple hello-vue
8+
npm install -g @vue/cli
9+
vue create hello-vue
1010
cd hello-vue
11-
npm install
12-
npm run dev # ready to go!
11+
npm run serve # ready to go!
1312
```

docs/en/workflow/linting.md

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
You may have been wondering how do you lint your code inside `*.vue` files, since they are not JavaScript. We will assume you are using [ESLint](https://eslint.org/) (if you are not, you should!).
44

5-
You will also need the [eslint-plugin-html](https://github.com/BenoitZugmeyer/eslint-plugin-html) which supports extracting and linting the JavaScript inside `*.vue` files.
5+
You will also need the official [eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue) which supports linting both the template and script parts of Vue files.
66

7-
Make sure to include the plugin in your ESLint config:
7+
Make sure to use the plugin's included config in your ESLint config:
88

99
``` json
10-
"plugins": [
11-
"html"
12-
]
10+
{
11+
"extends": [
12+
"plugin:vue/essential"
13+
]
14+
}
1315
```
1416

1517
Then from the command line:
@@ -24,68 +26,19 @@ Another option is using [eslint-loader](https://github.com/MoOx/eslint-loader) s
2426
npm install eslint eslint-loader --save-dev
2527
```
2628

27-
``` js
28-
// webpack.config.js
29-
module.exports = {
30-
// ... other options
31-
module: {
32-
loaders: [
33-
{
34-
test: /\.vue$/,
35-
loader: 'vue!eslint'
36-
}
37-
]
38-
}
39-
}
40-
```
41-
42-
Note that webpack loader chains are applied **right-first**. Make sure to apply `eslint` before `vue` so we are linting the pre-compile source code.
43-
44-
One thing we need to consider is using third party `*.vue` components shipped in NPM packages. In such case, we want to use `vue-loader` to process the third party component, but do not want to lint it. We can separate the linting into webpack's [preLoaders](https://webpack.github.io/docs/loaders.html#loader-order):
45-
46-
``` js
47-
// webpack.config.js
48-
module.exports = {
49-
// ... other options
50-
module: {
51-
// only lint local *.vue files
52-
preLoaders: [
53-
{
54-
test: /\.vue$/,
55-
loader: 'eslint',
56-
exclude: /node_modules/
57-
}
58-
],
59-
// but use vue-loader for all *.vue files
60-
loaders: [
61-
{
62-
test: /\.vue$/,
63-
loader: 'vue'
64-
}
65-
]
66-
}
67-
}
68-
```
69-
70-
For webpack 2.x:
29+
Make sure it's applied as a pre-loader:
7130

7231
``` js
7332
// webpack.config.js
7433
module.exports = {
7534
// ... other options
7635
module: {
7736
rules: [
78-
// only lint local *.vue files
7937
{
8038
enforce: 'pre',
81-
test: /\.vue$/,
39+
test: /\.(js|vue)$/,
8240
loader: 'eslint-loader',
8341
exclude: /node_modules/
84-
},
85-
// but use vue-loader for all *.vue files
86-
{
87-
test: /\.vue$/,
88-
loader: 'vue-loader'
8942
}
9043
]
9144
}

docs/en/workflow/production.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,12 @@ module.exports = {
1919
}
2020
}),
2121
// minify with dead-code elimination
22-
new webpack.optimize.UglifyJsPlugin({
23-
compress: {
24-
warnings: false
25-
}
26-
}),
27-
// webpack 1 only - optimize module ids by occurrence count
28-
new webpack.optimize.OccurrenceOrderPlugin()
22+
new webpack.optimize.UglifyJsPlugin()
2923
]
3024
}
3125
```
3226

33-
Obviously we don't want to use this config during development, so there are several ways to approach this:
27+
We don't want to use this config during development, so there are several ways to approach this:
3428

3529
1. Dynamically build up the configuration object based on an environment variable;
3630

0 commit comments

Comments
 (0)