Skip to content

Commit 4560bc1

Browse files
committed
clarify no-build setup usage
close #1677
1 parent c4b999b commit 4560bc1

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/guide/quick-start.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ To get started with Vue without a build step, simply copy the following code int
7474
<div id="app">{{ message }}</div>
7575

7676
<script>
77-
Vue.createApp({
77+
const { createApp } = Vue
78+
79+
createApp({
7880
data() {
7981
return {
8082
message: 'Hello Vue!'
@@ -84,7 +86,11 @@ To get started with Vue without a build step, simply copy the following code int
8486
</script>
8587
```
8688

87-
The above example uses the global build of Vue where all APIs are exposed under the global `Vue` variable.
89+
The above example uses the global build of Vue where all APIs are exposed under the global `Vue` variable. For example, to also use the `ref` API, you can do:
90+
91+
```js
92+
const { createApp, ref } = Vue
93+
```
8894

8995
While the global build works, we will be primarily using [ES modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) syntax throughout the rest of the documentation for consistency. In order to use Vue over native ES modules, use the following HTML instead:
9096

@@ -112,11 +118,15 @@ While the global build works, we will be primarily using [ES modules](https://de
112118
</script>
113119
```
114120

115-
Notice how we can import directly from `'vue'` in our code - this is made possible by the `<script type="importmap">` block, leveraging a native browser feature called [Import Maps](https://caniuse.com/import-maps). Import maps are currently only available in Chromium-based browsers, so we recommend using Chrome or Edge during the learning process. If your preferred browser does not support import maps yet, you can polyfill it with [es-module-shims](https://github.com/guybedford/es-module-shims).
121+
Notice how we can import directly from `'vue'` in our code - this is made possible by the `<script type="importmap">` block, leveraging a native browser feature called [Import Maps](https://caniuse.com/import-maps).
116122

117123
You can add entries for other dependencies to the import map - just make sure they point to the ES modules version of the library you intend to use.
118124

119-
:::tip Not for production
125+
:::tip Import Maps Browser Support
126+
Import maps are currently only available in Chromium-based browsers, so we recommend using Chrome or Edge during the learning process. If your preferred browser does not support import maps yet, you can polyfill it with [es-module-shims](https://github.com/guybedford/es-module-shims).
127+
:::
128+
129+
:::warning Not for production
120130
The import-maps-based setup is meant for learning only - if you intend to use Vue without build tools in production, make sure to check out the [Production Deployment Guide](/guide/best-practices/production-deployment.html#without-build-tools).
121131
:::
122132

0 commit comments

Comments
 (0)