File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ module.exports = {
3939 '' ,
4040 'configuration' ,
4141 'directives' ,
42+ 'webpack' ,
4243 ] ,
4344 } ,
4445 } ,
Original file line number Diff line number Diff line change 1+ # Webpack configuration
2+
3+ In ` api.chainWebpack ` and ` api.configureWebpack ` , you have access to some environment variables:
4+
5+ - ** ` process.env.VUE_CLI_SSR_TARGET ` ** : Either ` 'client' ` or ` 'server' `
6+
7+ - ** ` process.env.VUE_CLI_MODE ` ** : Vue CLI mode
8+
9+ Examples:
10+
11+ ``` 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+ })
19+ ```
20+
21+ ``` 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
30+ }
31+ }
32+ })
33+ ```
You can’t perform that action at this time.
0 commit comments