JavaScript/vue.js/defineAsyncComponent:修订间差异
来自康健生活
| 第85行: | 第85行: | ||
const Select = defineAsyncComponent(async () => await import(/* selecct component by es url*/)) | const Select = defineAsyncComponent(async () => await import(/* selecct component by es url*/)) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==== package.json ==== | |||
<blockquote> | |||
// ... | |||
"main": "./bundle/linking-kwy.cjs.js", | |||
"module": "./bundle/linking-kwy.es.js", | |||
"exports": { | |||
".": { | |||
"import": "./bundle/linking-kwy.es.js", | |||
"require": "./bundle/linking-kwy.cjs.js" | |||
} | |||
}, | |||
// ...</blockquote> | |||
=== CSS === | === CSS === | ||
在打包过程中可以通过组件 vite-plugin-css-injected-by-js 将 CSS 合并入 JS 文件中,使用起来也很简单 | 在打包过程中可以通过组件 vite-plugin-css-injected-by-js 将 CSS 合并入 JS 文件中,使用起来也很简单 | ||