import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
export default defineConfig({
plugins: [uni()],
build: {
minify: 'terser',
terserOptions: {
compress: {
drop_console: true,
},
},
},
});
产品分类: uniapp/小程序/阿里
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10
第三方开发者工具版本号: 3.2.6
基础库版本号: 2.8.0
项目创建方式: CLI
CLI版本号: 4.5.3
import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
export default defineConfig({
plugins: [uni()],
build: {
minify: 'terser',
terserOptions: {
compress: {
drop_console: true,
},
},
},
});
配置vite文件,使用npm run dev:mp-alipay之后导入dist/dev/mp-alipay到开发工具运行报错
正常运行
运行报错
s***@126.com (作者)
60 packages are looking for funding
run npm fund
for details
NyandeMacBook-Pro:zxyy_main_miniapp nyan$ npm run dev:mp-alipay
uni-preset-vue@0.0.0 dev:mp-alipay /Users/nyan/workspace/zxyy_main_miniapp
uni -p mp-alipay
/Users/nyan/workspace/zxyy_main_miniapp/node_modules/vite/dist/node-cjs/publicUtils.cjs:5410
timeFormatter ??= new Intl.DateTimeFormat(undefined, {
^^^
SyntaxError: Unexpected token '??='
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/Users/nyan/workspace/zxyy_main_miniapp/node_modules/vite/index.cjs:9:31)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! uni-preset-vue@0.0.0 dev:mp-alipay: uni -p mp-alipay
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the uni-preset-vue@0.0.0 dev:mp-alipay script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/nyan/.npm/_logs/2024-08-07T02_09_59_026Z-debug.log
s***@126.com (作者)
回复 BFC: 但是升级之后,有些依赖又报错了Package subpath './dist/vuex.esm-bundler.js' is not defined by "exports" in /Users/nyan/workspace/zxyy_main_miniapp/node_modules/vuex/package.json
^C
2024-08-07 10:19
s***@126.com (作者)
请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。若要正式发布,请点击发行菜单或使用 cli 发布命令进行发布
正在编译中...
(node:5012) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/nyan/workspace/zxyy_main_miniapp/node_modules/vuex/package.json.
Update this package.json to use a subpath pattern like "./*".
(Use node --trace-deprecation ...
to show where the warning was created)
DONE Build complete. Watching for changes...
运行方式:打开 支付宝小程序开发者工具, 导入 dist/dev/mp-alipay 运行。
ready in 37636ms.
2024-08-07 10:20
上传一下demo工程,我这边看下
s***@126.com (作者)
解决hbuilder编译报错问题-----升级之后,有些依赖又报错了Package subpath './dist/vuex.esm-bundler.js' is not defined by "exports" in /Users/nyan/workspace/zxyy_main_miniapp/node_modules/vuex/package.json
2024-08-15 16:44
s***@126.com (作者)
是的
2024-08-03 12:32