You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: deprecate confusing baseUrl option, use publicPath instead. (#3143)
* feat: deprecate confusing `baseUrl` option, use `publicPath` instead.
* fix: do not touch CHANGELOG.md
* docs: links referring baseUrl now changed to publicPath
Copy file name to clipboardExpand all lines: docs/config/README.md
+10-6
Original file line number
Diff line number
Diff line change
@@ -31,17 +31,21 @@ module.exports = {
31
31
32
32
### baseUrl
33
33
34
+
Deprecated since Vue CLI 3.3, please use [`publicPath`](#publicPath) instead.
35
+
36
+
### publicPath
37
+
34
38
- Type: `string`
35
39
- Default: `'/'`
36
40
37
-
The base URL your application bundle will be deployed at. This is the equivalent of webpack's `output.publicPath`, but Vue CLI also needs this value for other purposes, so you should **always use `baseUrl` instead of modifying webpack `output.publicPath`**.
41
+
The base URL your application bundle will be deployed at (known as `baseUrl` before Vue CLI 3.3). This is the equivalent of webpack's `output.publicPath`, but Vue CLI also needs this value for other purposes, so you should **always use `publicPath` instead of modifying webpack `output.publicPath`**.
38
42
39
-
By default, Vue CLI assumes your app will be deployed at the root of a domain, e.g. `https://www.my-app.com/`. If your app is deployed at a sub-path, you will need to specify that sub-path using this option. For example, if your app is deployed at `https://www.foobar.com/my-app/`, set `baseUrl` to `'/my-app/'`.
43
+
By default, Vue CLI assumes your app will be deployed at the root of a domain, e.g. `https://www.my-app.com/`. If your app is deployed at a sub-path, you will need to specify that sub-path using this option. For example, if your app is deployed at `https://www.foobar.com/my-app/`, set `publicPath` to `'/my-app/'`.
40
44
41
45
The value can also be set to an empty string (`''`) or a relative path (`./`) so that all assets are linked using relative paths. This allows the built bundle to be deployed under any public path, or used in a file system based environment like a Cordova hybrid app.
42
46
43
-
::: warning Limitations of relative baseUrl
44
-
Relative `baseUrl` has some limitations and should be avoided when:
47
+
::: warning Limitations of relative publicPath
48
+
Relative `publicPath` has some limitations and should be avoided when:
45
49
46
50
- You are using HTML5 `history.pushState` routing;
47
51
@@ -52,7 +56,7 @@ module.exports = {
52
56
53
57
```js
54
58
module.exports= {
55
-
baseUrl:process.env.NODE_ENV==='production'
59
+
publicPath:process.env.NODE_ENV==='production'
56
60
?'/production-sub-path/'
57
61
:'/'
58
62
}
@@ -304,7 +308,7 @@ module.exports = {
304
308
305
309
- Some values like `host`, `port` and `https` may be overwritten by command line flags.
306
310
307
-
- Some values like `publicPath` and `historyApiFallback` should not be modified as they need to be synchronized with [baseUrl](#baseurl) for the dev server to function properly.
311
+
- Some values like `publicPath` and `historyApiFallback` should not be modified as they need to be synchronized with [publicPath](#baseurl) for the dev server to function properly.
Copy file name to clipboardExpand all lines: docs/guide/deployment.md
+10-10
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,11 @@
4
4
5
5
If you are using Vue CLI along with a backend framework that handles static assets as part of its deployment, all you need to do is make sure Vue CLI generates the built files in the correct location, and then follow the deployment instruction of your backend framework.
6
6
7
-
If you are developing your frontend app separately from your backend - i.e. your backend exposes an API for your frontend to talk to, then your frontend is essentially a purely static app. You can deploy the built content in the `dist` directory to any static file server, but make sure to set the correct [baseUrl](../config/#baseurl).
7
+
If you are developing your frontend app separately from your backend - i.e. your backend exposes an API for your frontend to talk to, then your frontend is essentially a purely static app. You can deploy the built content in the `dist` directory to any static file server, but make sure to set the correct [publicPath](../config/#publicpath).
8
8
9
9
### Previewing Locally
10
10
11
-
The `dist` directory is meant to be served by an HTTP server (unless you've configured `baseUrl` to be a relative value), so it will not work if you open `dist/index.html` directly over `file://` protocol. The easiest way to preview your production build locally is using a Node.js static file server, for example [serve](https://github.com/zeit/serve):
11
+
The `dist` directory is meant to be served by an HTTP server (unless you've configured `publicPath` to be a relative value), so it will not work if you open `dist/index.html` directly over `file://` protocol. The easiest way to preview your production build locally is using a Node.js static file server, for example [serve](https://github.com/zeit/serve):
12
12
13
13
```bash
14
14
npm install -g serve
@@ -35,15 +35,15 @@ If you are using the PWA plugin, your app must be served over HTTPS so that [Ser
35
35
36
36
### GitHub Pages
37
37
38
-
1. Set correct `baseUrl` in `vue.config.js`.
38
+
1. Set correct `publicPath` in `vue.config.js`.
39
39
40
-
If you are deploying to `https://<USERNAME>.github.io/`, you can omit `baseUrl` as it defaults to `"/"`.
40
+
If you are deploying to `https://<USERNAME>.github.io/`, you can omit `publicPath` as it defaults to `"/"`.
41
41
42
-
If you are deploying to `https://<USERNAME>.github.io/<REPO>/`, (i.e. your repository is at `https://github.com/<USERNAME>/<REPO>`), set `baseUrl` to `"/<REPO>/"`. For example, if your repo name is "my-project", your `vue.config.js` should look like this:
42
+
If you are deploying to `https://<USERNAME>.github.io/<REPO>/`, (i.e. your repository is at `https://github.com/<USERNAME>/<REPO>`), set `publicPath` to `"/<REPO>/"`. For example, if your repo name is "my-project", your `vue.config.js` should look like this:
43
43
44
44
```js
45
45
module.exports= {
46
-
baseUrl:process.env.NODE_ENV==='production'
46
+
publicPath:process.env.NODE_ENV==='production'
47
47
?'/my-project/'
48
48
:'/'
49
49
}
@@ -112,7 +112,7 @@ Typically, your static website will be hosted on https://yourUserName.gitlab.io/
112
112
// make sure you update `yourProjectName` with the name of your GitLab project
113
113
114
114
module.exports = {
115
-
baseUrl: process.env.NODE_ENV === 'production'
115
+
publicPath: process.env.NODE_ENV === 'production'
116
116
? '/yourProjectName/'
117
117
: '/'
118
118
}
@@ -291,11 +291,11 @@ Verify your project is successfully published by Surge by visiting `myawesomepro
291
291
292
292
1. As described in the [Bitbucket documentation](https://confluence.atlassian.com/bitbucket/publishing-a-website-on-bitbucket-cloud-221449776.html) you need to create a repository named exactly `<USERNAME>.bitbucket.io`.
293
293
294
-
2. It is possible to publish to a subfolder of the main repository, for instance if you want to have multiple websites. In that case set correct `baseUrl` in `vue.config.js`.
294
+
2. It is possible to publish to a subfolder of the main repository, for instance if you want to have multiple websites. In that case set correct `publicPath` in `vue.config.js`.
295
295
296
-
If you are deploying to `https://<USERNAME>.bitbucket.io/`, you can omit `baseUrl` as it defaults to `"/"`.
296
+
If you are deploying to `https://<USERNAME>.bitbucket.io/`, you can omit `publicPath` as it defaults to `"/"`.
297
297
298
-
If you are deploying to `https://<USERNAME>.bitbucket.io/<SUBFOLDER>/`, set `baseUrl` to `"/<SUBFOLDER>/"`. In this case the directory structure of the repository should reflect the url structure, for instance the repository should have a `/<SUBFOLDER>` directory.
298
+
If you are deploying to `https://<USERNAME>.bitbucket.io/<SUBFOLDER>/`, set `publicPath` to `"/<SUBFOLDER>/"`. In this case the directory structure of the repository should reflect the url structure, for instance the repository should have a `/<SUBFOLDER>` directory.
299
299
300
300
3. Inside your project, create `deploy.sh` with the following content and run it to deploy:
Copy file name to clipboardExpand all lines: docs/guide/html-and-static-assets.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ In addition to the [default values exposed by `html-webpack-plugin`](https://git
21
21
```
22
22
23
23
See also:
24
-
-[baseUrl](../config/#baseurl)
24
+
-[publicPath](../config/#publicpath)
25
25
26
26
### Preload
27
27
@@ -166,7 +166,7 @@ Note we recommend importing assets as part of your module dependency graph so th
166
166
- Missing files cause compilation errors instead of 404 errors for your users.
167
167
- Result filenames include content hashes so you don’t need to worry about browsers caching their old versions.
168
168
169
-
The `public` directory is provided as an **escape hatch**, and when you reference it via absolute path, you need to take into account where your app will be deployed. If your app is not deployed at the root of a domain, you will need to prefix your URLs with the [baseUrl](../config/#baseurl):
169
+
The `public` directory is provided as an **escape hatch**, and when you reference it via absolute path, you need to take into account where your app will be deployed. If your app is not deployed at the root of a domain, you will need to prefix your URLs with the [publicPath](../config/#publicpath):
170
170
171
171
- In `public/index.html` or other HTML files used as templates by `html-webpack-plugin`, you need to prefix the link with `<%= BASE_URL %>`:
172
172
@@ -179,15 +179,15 @@ The `public` directory is provided as an **escape hatch**, and when you referenc
Copy file name to clipboardExpand all lines: docs/guide/mode-and-env.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ During build, `process.env.VUE_APP_SECRET` will be replaced by the corresponding
81
81
In addition to `VUE_APP_*` variables, there are also two special variables that will always be available in your app code:
82
82
83
83
-`NODE_ENV` - this will be one of `"development"`, `"production"` or `"test"` depending on the [mode](#modes) the app is running in.
84
-
-`BASE_URL` - this corresponds to the `baseUrl` option in `vue.config.js` and is the base path your app is deployed at.
84
+
-`BASE_URL` - this corresponds to the `publicPath` option in `vue.config.js` and is the base path your app is deployed at.
85
85
86
86
All resolved env variables will be available inside `public/index.html` as discussed in [HTML - Interpolation](./html-and-static-assets.md#interpolation).
Copy file name to clipboardExpand all lines: docs/guide/webpack.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ module.exports = {
18
18
The object will be merged into the final webpack config using [webpack-merge](https://github.com/survivejs/webpack-merge).
19
19
20
20
::: warning
21
-
Some webpack options are set based on values in `vue.config.js` and should not be mutated directly. For example, instead of modifying `output.path`, you should use the `outputDir` option in `vue.config.js`; instead of modifying `output.publicPath`, you should use the `baseUrl` option in `vue.config.js`. This is because the values in `vue.config.js` will be used in multiple places inside the config to ensure everything works properly together.
21
+
Some webpack options are set based on values in `vue.config.js` and should not be mutated directly. For example, instead of modifying `output.path`, you should use the `outputDir` option in `vue.config.js`; instead of modifying `output.publicPath`, you should use the `publicPath` option in `vue.config.js`. This is because the values in `vue.config.js` will be used in multiple places inside the config to ensure everything works properly together.
22
22
:::
23
23
24
24
If you need conditional behavior based on the environment, or want to directly mutate the config, use a function (which will be lazy evaluated after the env variables are set). The function receives the resolved config as the argument. Inside the function, you can either mutate the config directly, OR return an object which will be merged:
Copy file name to clipboardExpand all lines: docs/ru/config/README.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -29,19 +29,19 @@ module.exports = {
29
29
}
30
30
```
31
31
32
-
### baseUrl
32
+
### publicPath
33
33
34
34
- Тип: `string`
35
35
- По умолчанию: `'/'`
36
36
37
-
Базовый URL-адрес сборки вашего приложения, по которому оно будет опубликовано. Это аналог опции webpack `output.publicPath`, но Vue CLI также использует это значение в других целях, поэтому вы должны **всегда использовать `baseUrl` вместо изменения опции `output.publicPath`**.
37
+
Базовый URL-адрес сборки вашего приложения, по которому оно будет опубликовано. Это аналог опции webpack `output.publicPath`, но Vue CLI также использует это значение в других целях, поэтому вы должны **всегда использовать `publicPath` вместо изменения опции `output.publicPath`**.
38
38
39
-
По умолчанию Vue CLI считает, что публикация будет выполнена в корень домена, например `https://www.my-app.com/`. Если приложение публикуется в подкаталог, то необходимо указать этот путь с помощью этой опции. Например, если приложение будет публиковаться по адресу `https://www.foobar.com/my-app/`, установите `baseUrl` в значение `'/my-app/'`.
39
+
По умолчанию Vue CLI считает, что публикация будет выполнена в корень домена, например `https://www.my-app.com/`. Если приложение публикуется в подкаталог, то необходимо указать этот путь с помощью этой опции. Например, если приложение будет публиковаться по адресу `https://www.foobar.com/my-app/`, установите `publicPath` в значение `'/my-app/'`.
40
40
41
41
Значение также может быть пустой строкой (`''`) или относительным путём (`./`), чтобы все ресурсы подключались через относительные пути. Это позволит публиковать сборку в любой публичный каталог, или использовать в окружении файловой системы, например в гибридном приложении Cordova.
42
42
43
-
::: warning Ограничения относительного baseUrl
44
-
Относительный `baseUrl` имеет некоторые ограничения и его следует избегать если:
43
+
::: warning Ограничения относительного publicPath
44
+
Относительный `publicPath` имеет некоторые ограничения и его следует избегать если:
45
45
46
46
- Вы используете маршрутизацию HTML5 `history.pushState`;
47
47
@@ -52,7 +52,7 @@ module.exports = {
52
52
53
53
```js
54
54
module.exports= {
55
-
baseUrl:process.env.NODE_ENV==='production'
55
+
publicPath:process.env.NODE_ENV==='production'
56
56
?'/production-sub-path/'
57
57
:'/'
58
58
}
@@ -304,7 +304,7 @@ module.exports = {
304
304
305
305
- Некоторые значения, такие как `host`, `port` и `https`, могут перезаписываться флагами командной строки.
306
306
307
-
- Некоторые значения, такие как `publicPath` и `historyApiFallback`, нельзя изменять, поскольку они должны быть синхронизированы с [baseUrl](#baseurl) для правильной работы сервера разработки.
307
+
- Некоторые значения, такие как `publicPath` и `historyApiFallback`, нельзя изменять, поскольку они должны быть синхронизированы с [publicPath](#baseurl) для правильной работы сервера разработки.
0 commit comments