File tree Expand file tree Collapse file tree 1 file changed +30
-19
lines changed Expand file tree Collapse file tree 1 file changed +30
-19
lines changed Original file line number Diff line number Diff line change 1
1
# Webpack configuration
2
2
3
- In ` api.chainWebpack ` and ` api.configureWebpack ` , you have access to some environment variables:
3
+ In the ` chainWebpack() ` and ` configureWebpack() ` options ` vue.config.js ` , you have access to some environment
4
+ variables:
4
5
5
6
- ** ` process.env.VUE_CLI_SSR_TARGET ` ** : Either ` 'client' ` or ` 'server' `
6
7
7
8
- ** ` process.env.VUE_CLI_MODE ` ** : Vue CLI mode
8
9
9
- Examples :
10
+ ` vue.config.js ` 's ` chainWebpack() ` option :
10
11
11
12
``` js
12
- api .chainWebpack (config => {
13
- if (process .env .VUE_CLI_SSR_TARGET === ' client' ) {
14
- // Client-only config
15
- } else {
16
- // SSR-only config
17
- }
18
- })
13
+ module .exports = {
14
+ // ...
15
+ chainWebpack (config => {
16
+ if (process .env .VUE_CLI_SSR_TARGET === ' client' ) {
17
+ // Client-only config
18
+ } else {
19
+ // SSR-only config
20
+ }
21
+ }),
22
+ // ...
23
+ }
19
24
```
20
25
26
+ ` vue.config.js ` 's ` configureWebpack() ` option:
27
+
21
28
``` js
22
- api .configureWebpack (config => {
23
- if (process .env .VUE_CLI_SSR_TARGET === ' client' ) {
24
- return {
25
- // Client-only config
26
- }
27
- } else {
28
- return {
29
- // SSR-only config
29
+ module .exports = {
30
+ // ...
31
+ configureWebpack (config => {
32
+ if (process .env .VUE_CLI_SSR_TARGET === ' client' ) {
33
+ return {
34
+ // Client-only config
35
+ }
36
+ } else {
37
+ return {
38
+ // SSR-only config
39
+ }
30
40
}
31
- }
32
- })
41
+ }),
42
+ // ...
43
+ }
33
44
```
You can’t perform that action at this time.
0 commit comments