|
|
@@ -3,6 +3,9 @@ import { defineConfig, loadEnv } from 'vite'
|
|
|
import Uni from '@dcloudio/vite-plugin-uni'
|
|
|
// @see https://uni-helper.js.org/vite-plugin-uni-pages
|
|
|
import UniPages from '@uni-helper/vite-plugin-uni-pages'
|
|
|
+// @see https://github.com/uni-helper/vite-plugin-uni-platform
|
|
|
+// 需要与 @uni-helper/vite-plugin-uni-pages 插件一起使用
|
|
|
+import UniPlatform from '@uni-helper/vite-plugin-uni-platform'
|
|
|
import dayjs from 'dayjs'
|
|
|
import svgLoader from 'vite-svg-loader'
|
|
|
import { visualizer } from 'rollup-plugin-visualizer'
|
|
|
@@ -44,8 +47,9 @@ export default ({ command, mode }) => {
|
|
|
console.log(process.env.UNI_PLATFORM) // 得到 mp-weixin, h5 等
|
|
|
return defineConfig({
|
|
|
plugins: [
|
|
|
- // UniPages() 需要在 Uni() 之前引入
|
|
|
UniPages({ exclude: ['**/components/**/**.*'] }),
|
|
|
+ UniPlatform(),
|
|
|
+ // UniXX() 都需要在 Uni() 之前引入
|
|
|
Uni(),
|
|
|
UnoCSS(),
|
|
|
process.env.UNI_PLATFORM === 'h5' && htmlPlugin(env.VITE_APP_TITLE),
|