File tree 3 files changed +33
-3
lines changed
3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change 6
6
7
7
` Mode ` is an important concept in Vue CLI projects. By default, there are three modes:
8
8
9
- -
9
+ - ` development ` is used by ` vue-cli-service serve `
10
+ - ` test ` is used by ` vue-cli-service test:unit `
11
+ - ` production ` is used by ` vue-cli-service build ` and ` vue-cli-service e2e `
12
+
13
+ However, you can overwrite the mode default used for a command by using ` --mode ` option flag.
14
+
15
+ ```
16
+ vue-cli-service build --mode development
17
+ ```
18
+
19
+ ### Environment Variables
20
+
21
+ You can specify env variable by placing the following file in your project root.
22
+
23
+ ```
24
+ .env # loaded in all cases
25
+ .env.local # loaded in all cases, ignored by git
26
+ .env.[mode] # only loaded in specified mode
27
+ .env.[mode].local # only loaded in specified mode, ignored by git
28
+ ```
29
+
30
+ An env file simply contains key=value pairs of envaironment variables:
31
+
32
+ ```
33
+ FOO=bar
34
+ VUE_APP_NOT_SECRET_CODE=some_value
35
+ ```
36
+
37
+ Do not store any secrets (such as API private key) in your project.
Original file line number Diff line number Diff line change 5
5
"scripts" : {
6
6
"serve" : " vue-cli-service serve" ,
7
7
"build" : " vue-cli-service build" ,
8
- "lint" : " vue-cli-service lint"
8
+ "lint" : " vue-cli-service lint" ,
9
+ "test:unit" : " vue-cli-service test:unit"
9
10
},
10
11
"dependencies" : {
11
12
"core-js" : " ^3.8.3" ,
Original file line number Diff line number Diff line change @@ -2,5 +2,6 @@ const { defineConfig } = require("@vue/cli-service");
2
2
3
3
module . exports = defineConfig ( {
4
4
transpileDependencies : true ,
5
- publicPath : "/test/" ,
5
+ publicPath :
6
+ process . env . NODE_ENV === "production" ? "/production" : "/development" ,
6
7
} ) ;
You can’t perform that action at this time.
0 commit comments