-
rslib 打包 三方包有引用extrenal的库会被打包成external_react_["default"] 如果要将三方包打入bundle应该如何解决 配置rslib.config lib: [
{
bundle: true,
dts: true,
format: 'esm',
},
],
output: {
target: 'web',
emitCss:true,
injectStyles:true
}, dependencies依赖 react-hook-form 问题由于react-hook-form 依赖了react var external_react_ = __webpack_require__("react")
// 引用了其他库打包成
const HookFormContext = external_react_["default"].createContext(null)
//
//而在项目中的使用到react是正常的 是这种使用方式external_react_.useState
external_react_["default"] 只会出现在项目引用其他包的情况 目标三方包也倒入到本项目的bundle中并且位正确格式如 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 12 replies
-
since no reproduction is provided, i can't see clear of your issue. but we just met a similar issue (here's the minimal reproduction https://github.com/fi3ework-reproduction/wrong-external-module-after-multiple-pack). is this one identical with your case? |
Beta Was this translation helpful? Give feedback.
-
i think the |
Beta Was this translation helpful? Give feedback.
-
close via #1193 |
Beta Was this translation helpful? Give feedback.
web-infra-dev/rsbuild#5955 will resovle this.