npm run build
- 发布:2021-11-02 16:53
- 更新:2021-11-24 14:07
- 阅读:782
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 11.4
手机系统: iOS
手机系统版本号: iOS 15
手机厂商: 苹果
手机机型: -
页面类型: vue
打包方式: 云端
项目创建方式: CLI
CLI版本号: 329
操作步骤:
预期结果:
生成编译后的文件
生成编译后的文件
实际结果:
未生成文件
未生成文件
bug描述:
cli 项目,依赖库更新到 329 后无法正常打包,表现为 执行编译命令后正常退出无报错,但未在 dist 目录生成文件。
这个问题太严重了 直接不能用啊
github 上有类似的 issue https://github.com/dcloudio/uni-app/issues/2935
用 vue cli 新建 uni hello 项目后也不能编译
❯ npm run info
> hello@0.1.0 info
> node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js
uni-app v3.1.8
uni-app cli v2.0.0-32920211029001
Environment Info:
System:
OS: macOS 11.6
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Binaries:
Node: 16.11.1 - ~/.nvm/versions/node/v16.11.1/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 8.0.0 - ~/.nvm/versions/node/v16.11.1/bin/npm
Browsers:
Chrome: 95.0.4638.69
Firefox: Not Found
Safari: 15.0
npmPackages:
@dcloudio/types: * => 2.5.12
@dcloudio/uni-app-plus: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-app-plus-nvue: 0.0.1
@dcloudio/uni-app-plus-nvue-v8: 0.0.1
@dcloudio/uni-automator: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-cli-i18n: ^2.0.0-32920211029001 => 2.0.0-alpha-32920211022004
@dcloudio/uni-cli-shared: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-h5: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-helper-json: * => 1.0.13
@dcloudio/uni-i18n: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-migration: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-mp-360: ^2.0.0-32920211029001 => 2.0.0-alpha-32920211022004
@dcloudio/uni-mp-alipay: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-mp-baidu: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-mp-kuaishou: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-mp-qq: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-mp-toutiao: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-mp-vue: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-mp-weixin: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-quickapp-native: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-quickapp-webview: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/uni-stat: ^2.0.0-32920211029001 => 2.0.0-32920211029001
@dcloudio/uni-template-compiler: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/vue-cli-plugin-hbuilderx: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/vue-cli-plugin-uni: ^2.0.0-32920211029001 => 2.0.0-32920211029001
@dcloudio/vue-cli-plugin-uni-optimize: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/webpack-uni-mp-loader: ^2.0.0-32920211029001 => 2.0.0
@dcloudio/webpack-uni-nvue-loader: 0.0.1
@dcloudio/webpack-uni-pages-loader: ^2.0.0-32920211029001 => 2.0.0
@hap-toolkit/dsl-vue: 0.6.13
@vue/babel-helper-vue-jsx-merge-props: 1.2.1
@vue/babel-helper-vue-transform-on: 1.0.2
@vue/babel-plugin-jsx: 1.1.1
@vue/babel-plugin-transform-vue-jsx: 1.2.1
@vue/babel-preset-app: 4.5.15
@vue/babel-preset-jsx: 1.2.4
@vue/babel-sugar-composition-api-inject-h: 1.2.1
@vue/babel-sugar-composition-api-render-instance: 1.2.4
@vue/babel-sugar-functional-vue: 1.2.2
@vue/babel-sugar-inject-h: 1.2.2
@vue/babel-sugar-v-model: 1.2.3
@vue/babel-sugar-v-on: 1.2.3
@vue/cli-overlay: 4.5.15
@vue/cli-plugin-babel: ~4.5.0 => 4.5.15
@vue/cli-plugin-router: 4.5.15
@vue/cli-plugin-vuex: 4.5.15
@vue/cli-service: ~4.5.0 => 4.5.15
@vue/cli-shared-utils: 4.5.15
@vue/component-compiler-utils: 3.3.0 (3.3.0)
@vue/devtools-api: 6.0.0-beta.15
@vue/preload-webpack-plugin: 1.1.2
@vue/shared: ^3.0.0 => 3.2.21
@vue/web-component-wrapper: 1.3.0
mpvue-page-factory: 1.0.1
mpvue-template-compiler: 1.0.13
uni-h5-vue: 2.6.10
uni-mp-vue: 2.6.10
vue: ^2.6.11 => 2.6.14
vue-hot-reload-api: 2.3.4
vue-loader: 15.9.8 (16.8.2, 15.9.8)
vue-router: 3.0.1
vue-style-loader: 4.1.3 (4.1.3)
vue-template-compiler: ^2.6.11 => 2.6.14 (2.6.14)
vue-template-es2015-compiler: 1.9.1
vue3: 1.0.0
vuex: ^3.2.0 => 3.6.2 (3.6.2)
npmGlobalPackages:
@vue/cli: Not Found
appwociao (作者)
update:
如上所述,升级到 alpha 版本后解决了编译问题,但又带来了其它 bug
webview 无法加载,表现为白屏,报错如下
[ERROR] : TypeError: undefined is not a function (near '...this._onParentReady...')
同样的代码在之前版本中都是OK的。
appwociao (作者)
[ERROR] : TypeError: undefined is not a function (near '...this._onParentReady...')
上面提到的这个 BUG,研究了下,修复方式如下:
git clone https://github.com/dcloudio/uni-app
cd uni-app/
yarn
vim src/platforms/app-plus/view/components/web-view/index.vue
//在 <script> 下面增加
import native from '../../mixins/native'
//然后在 name: 'WebView', 一行下增加
mixins: [native],
//然后重新编译
npm run build:app:v3
//最后复制编译好的文件到你项目的 node_modules 下的对应路径
cp packages/uni-app-plus/dist/view.umd.min.js your_app/node_modules/@dcloudio/uni-app-plus/dist/view.umd.min.js
//重新打包启动APP,webview正常了
本来想提交个 pull request,还是算了 最近碰到太多 BUG 了,心累。
appwociao (作者)
没呢 等官方回复
2021-11-02 17:32
y***@163.com
回复 appwociao: 好坑啊,这么严重的问题
2021-11-02 17:34