docs: improve virtual module examples (#7636)

This commit is contained in:
dengqing 2022-04-07 16:25:36 +08:00 committed by GitHub
parent 4433df4c6b
commit c02537b5b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,7 +113,7 @@ Virtual modules are a useful scheme that allows you to pass build time informati
```js
export default function myPlugin() {
const virtualModuleId = '@my-virtual-module'
const virtualModuleId = 'virtual:my-module'
const resolvedVirtualModuleId = '\0' + virtualModuleId
return {
@ -135,7 +135,7 @@ export default function myPlugin() {
Which allows importing the module in JavaScript:
```js
import { msg } from '@my-virtual-module'
import { msg } from 'virtual:my-module'
console.log(msg)
```