1***@qq.com
1***@qq.com
  • 发布:2021-11-03 16:32
  • 更新:2022-10-21 21:21
  • 阅读:1462

【报Bug】uniapp 打包百度小程序 分包中的js 无法找到require('common/vendor.js')

分类:uni-app

产品分类: uniapp/小程序/百度

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 3.2.12

第三方开发者工具版本号: 百度开发者工具3.42.1

基础库版本号: 3.360.23

项目创建方式: HBuilderX

示例代码:

require('common/vendor.js');(global["webpackJsonp"] = global["webpackJsonp"] || []).push([["pages/user/set"],{

// 234:
/
! no static exports found /
/
/ (function(module, exports, __webpack_require__) {

"use strict";
/ WEBPACK VAR INJECTION /(function(createPage) {webpack_require(/! uni-pages / 5);
var _vue = _interopRequireDefault(
webpack_require
(/! vue / 3));
var _set = _interopRequireDefault(webpack_require__(/! ./pages/user/set.vue / 235));function _interopRequireDefault(obj) {return obj && obj.esModule ? obj : { default: obj };}
createPage(_set.default);
/ WEBPACK VAR INJECTION /}.call(this, __webpack_require__(/! ./node_modules/@dcloudio/uni-mp-baidu/dist/index.js / 1)["createPage"]))

/***/ }),

/***/ 235:

操作步骤:

require('common/vendor.js');(global["webpackJsonp"] = global["webpackJsonp"] || []).push([["pages/user/set"],{

// 234:
/
! no static exports found /
/
/ (function(module, exports, __webpack_require__) {

"use strict";
/ WEBPACK VAR INJECTION /(function(createPage) {webpack_require(/! uni-pages / 5);
var _vue = _interopRequireDefault(
webpack_require
(/! vue / 3));
var _set = _interopRequireDefault(webpack_require__(/! ./pages/user/set.vue / 235));function _interopRequireDefault(obj) {return obj && obj.esModule ? obj : { default: obj };}
createPage(_set.default);
/ WEBPACK VAR INJECTION /}.call(this, __webpack_require__(/! ./node_modules/@dcloudio/uni-mp-baidu/dist/index.js / 1)["createPage"]))

/***/ }),

/***/ 235:

预期结果:

require('../../common/vendor.js');(global["webpackJsonp"] = global["webpackJsonp"] || []).push([["pages/user/set"],{

// 234:
/
! no static exports found /
/
/ (function(module, exports, __webpack_require__) {

"use strict";
/ WEBPACK VAR INJECTION /(function(createPage) {webpack_require(/! uni-pages / 5);
var _vue = _interopRequireDefault(
webpack_require
(/! vue / 3));
var _set = _interopRequireDefault(webpack_require__(/! ./pages/user/set.vue / 235));function _interopRequireDefault(obj) {return obj && obj.esModule ? obj : { default: obj };}
createPage(_set.default);
/ WEBPACK VAR INJECTION /}.call(this, __webpack_require__(/! ./node_modules/@dcloudio/uni-mp-baidu/dist/index.js / 1)["createPage"]))

/***/ }),

/***/ 235:

实际结果:

require('.common/vendor.js');(global["webpackJsonp"] = global["webpackJsonp"] || []).push([["pages/user/set"],{

// 234:
/
! no static exports found /
/
/ (function(module, exports, __webpack_require__) {

"use strict";
/ WEBPACK VAR INJECTION /(function(createPage) {webpack_require(/! uni-pages / 5);
var _vue = _interopRequireDefault(
webpack_require
(/! vue / 3));
var _set = _interopRequireDefault(webpack_require__(/! ./pages/user/set.vue / 235));function _interopRequireDefault(obj) {return obj && obj.esModule ? obj : { default: obj };}
createPage(_set.default);
/ WEBPACK VAR INJECTION /}.call(this, __webpack_require__(/! ./node_modules/@dcloudio/uni-mp-baidu/dist/index.js / 1)["createPage"]))

/***/ }),

/***/ 235:

bug描述:

uniapp 打包百度小程序时,会导致分包中的js,无法找到 vendor.js,打包的结果是 require('common/vendor.js');(global["webpackJsonp"] = global["webpackJsonp"] || []).push([["pages/user/set"],{

解决方式是在 require('../../common/vendor.js')

2021-11-03 16:32 负责人:无 分享
已邀请:
西瓜小康子

西瓜小康子

你好 我这也遇见相同的问题了 请问下怎么处理的

该问题目前已经被锁定, 无法添加新回复