uniapp + vue3 + ts + vite 微信小程序正常,但是想打包app,真机调试,报错:
'login' is not exported by src/api/user.ts, imported by src/store/modules/user.ts
提示没爆入方法,但是确实爆入了,不然小程序也不正常,怀疑是vite打包问题,但是不知道啥情况
uniapp + vue3 + ts + vite 微信小程序正常,但是想打包app,真机调试,报错:
'login' is not exported by src/api/user.ts, imported by src/store/modules/user.ts
提示没爆入方法,但是确实爆入了,不然小程序也不正常,怀疑是vite打包问题,但是不知道啥情况
3 个回复
b***@gmail.com (作者)
通过export function 暴露方法的,以及通过cli从uniapp vue3 ts获取项目的,追加自己的代码
b***@gmail.com (作者)
这是vite.config:
import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [uni()],
resolve: {
// Vite路径别名配置
alias: {
'@': path.resolve('./src')
}
}
});
b***@gmail.com (作者)
控制台信息:
Compiler version: 3.6.1(vue3)
Please note that in running mode, due to log output, sourcemap, and uncompressed source code, the performance and package size are not as good as release mode.
Compiling...
vite v2.9.14 building for development...
'login' is not exported by src/api/user.ts, imported by src/store/modules/user.ts
at store/modules/user.ts:6:4
4:
5: import {
6: login,
^
7: getUserInfo,
8: logout