引入方式:
npm install pako
npm install @types/pako
运行:
运行到浏览器Chrome
代码:
ts文件中引入pako后报错。
import pako from "pako";
报错:
20:38:39.616 X [ERROR] [plugin uni:dep-scan] Unbalanced delimiter found in string
20:38:39.616 node_modules/xregexp/src/addons/matchrecursive.js:176:22:
20:38:39.616 176 │ throw new Error('Unbalanced delimiter found in st...
20:38:39.616 ╵ ^
20:38:39.616 at Function.XRegExp.matchRecursive (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\xregexp\src\addons\matchrecursive.js:176:23)
20:38:39.632 at matchReplacePass (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\lib\preprocess\lib\preprocess.js:309:27)
20:38:39.632 at replaceRecursive (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\lib\preprocess\lib\preprocess.js:339:10)
20:38:39.632 at preprocessor (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\lib\preprocess\lib\preprocess.js:164:10)
20:38:39.632 at preprocess (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\lib\preprocess\lib\preprocess.js:89:10)
20:38:39.632 at preJs (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\dist\preprocess\index.js:10:12)
20:38:39.632 at D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-h5-vite\dist\plugin\esbuild\esbuildPrePlugin.js:21:59
20:38:39.647 at requestCallbacks.on-load (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1426:28)
20:38:39.647 at handleRequest (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:727:19)
20:38:39.647 at handleIncomingPacket (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:749:7)
20:38:39.647 This error came from the "onLoad" callback registered here:
20:38:39.647 node_modules/@dcloudio/uni-h5-vite/dist/plugin/esbuild/esbuildPrePlugin.js:15:18:
20:38:39.647 15 │ build.onLoad({ filter: exports.JS_TYPES_RE }, ({ path:...
20:38:39.663 ╵ ~~
20:38:39.663 at setup (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-h5-vite\dist\plugin\esbuild\esbuildPrePlugin.js:15:19)
20:38:39.663 at handlePlugins (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1287:21)
20:38:39.663 at buildOrServeImpl (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:974:5)
20:38:39.663 at Object.buildOrServe (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:780:5)
20:38:39.679 at D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:2132:17
20:38:39.679 at new Promise (<anonymous>)
20:38:39.679 at Object.build (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:2131:14)
20:38:39.679 at build (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1978:51)
20:38:39.679 at runOptimizeDeps (file:///D:/dev/HBuilderX/plugins/uniapp-cli-vite/node_modules/vite/dist/node/chunks/dep-ca21228b.js:42966:26)
20:38:39.679 D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1604
20:38:39.694 let error = new Error(${text}${summary}
);
20:38:39.694 ^
20:38:39.702 Error: Build failed with 1 error:
20:38:39.702 node_modules/xregexp/src/addons/matchrecursive.js:176:22: ERROR: [plugin: uni:dep-scan] Unbalanced delimiter found in string
20:38:39.702 at failureErrorWithLog (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1604:15)
20:38:39.710 at D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1056:28
20:38:39.710 at runOnEndCallbacks (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1476:61)
20:38:39.710 at buildResponseToResult (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1054:7)
20:38:39.710 at D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1166:14
20:38:39.710 at responseCallbacks.<computed> (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:701:9)
20:38:39.710 at handleIncomingPacket (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:756:9)
20:38:39.710 at Socket.readFromStdout (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:677:7)
20:38:39.710 at Socket.emit (node:events:513:28)
20:38:39.710 at addChunk (node:internal/streams/readable:315:12) {
20:38:39.726 errors: [
20:38:39.726 {
20:38:39.726 detail: Error: Unbalanced delimiter found in string
20:38:39.726 at Function.XRegExp.matchRecursive (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\xregexp\src\addons\matchrecursive.js:176:23)
20:38:39.726 at matchReplacePass (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\lib\preprocess\lib\preprocess.js:309:27)
20:38:39.726 at replaceRecursive (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\lib\preprocess\lib\preprocess.js:339:10)
20:38:39.726 at preprocessor (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\lib\preprocess\lib\preprocess.js:164:10)
20:38:39.742 at preprocess (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\lib\preprocess\lib\preprocess.js:89:10)
20:38:39.742 at preJs (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\dist\preprocess\index.js:10:12)
20:38:39.742 at D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-h5-vite\dist\plugin\esbuild\esbuildPrePlugin.js:21:59
20:38:39.742 at requestCallbacks.on-load (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1426:28)
20:38:39.742 at handleRequest (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:727:19)
20:38:39.742 at handleIncomingPacket (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:749:7),
20:38:39.742 id: '',
20:38:39.742 location: {
20:38:39.742 column: 22,
20:38:39.742 file: 'node_modules/xregexp/src/addons/matchrecursive.js',
20:38:39.757 length: 0,
20:38:39.757 line: 176,
20:38:39.757 lineText: " throw new Error('Unbalanced delimiter found in string');\n" +
20:38:39.757 ' at Function.XRegExp.matchRecursive (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\xregexp\src\addons\matchrecursive.js:176:23)\n' +
20:38:39.757 ' at matchReplacePass (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\lib\preprocess\lib\preprocess.js:309:27)\n' +
20:38:39.757 ' at replaceRecursive (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\lib\preprocess\lib\preprocess.js:339:10)\n' +
20:38:39.757 ' at preprocessor (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\lib\preprocess\lib\preprocess.js:164:10)\n' +
20:38:39.757 ' at preprocess (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\lib\preprocess\lib\preprocess.js:89:10)\n' +
20:38:39.757 ' at preJs (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-cli-shared\dist\preprocess\index.js:10:12)\n' +
20:38:39.757 ' at D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-h5-vite\dist\plugin\esbuild\esbuildPrePlugin.js:21:59\n' +
20:38:39.773 ' at requestCallbacks.on-load (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1426:28)\n' +
20:38:39.773 ' at handleRequest (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:727:19)\n' +
20:38:39.773 ' at handleIncomingPacket (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:749:7)',
20:38:39.773 namespace: 'file',
20:38:39.773 suggestion: ''
20:38:39.773 },
20:38:39.773 notes: [
20:38:39.773 {
20:38:39.773 location: {
20:38:39.773 column: 18,
20:38:39.789 file: 'node_modules/@dcloudio/uni-h5-vite/dist/plugin/esbuild/esbuildPrePlugin.js',
20:38:39.790 length: 6,
20:38:39.790 line: 15,
20:38:39.790 lineText: ' build.onLoad({ filter: exports.JS_TYPES_RE }, ({ path: id }) => {\n' +
20:38:39.790 ' at setup (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\@dcloudio\uni-h5-vite\dist\plugin\esbuild\esbuildPrePlugin.js:15:19)\n' +
20:38:39.790 ' at handlePlugins (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1287:21)\n' +
20:38:39.790 ' at buildOrServeImpl (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:974:5)\n' +
20:38:39.790 ' at Object.buildOrServe (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:780:5)\n' +
20:38:39.802 ' at D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:2132:17\n' +
20:38:39.804 ' at new Promise (<anonymous>)\n' +
20:38:39.804 ' at Object.build (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:2131:14)\n' +
20:38:39.804 ' at build (D:\dev\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1978:51)\n' +
20:38:39.804 ' at runOptimizeDeps (file:///D:/dev/HBuilderX/plugins/uniapp-cli-vite/node_modules/vite/dist/node/chunks/dep-ca21228b.js:42966:26)',
20:38:39.804 namespace: 'file',
20:38:39.804 suggestion: ''
20:38:39.804 },
20:38:39.804 text: 'This error came from the "onLoad" callback registered here:'
20:38:39.804 }
20:38:39.820 ],
20:38:39.820 pluginName: 'uni:dep-scan',
20:38:39.820 text: 'Unbalanced delimiter found in string'
20:38:39.820 }
20:38:39.820 ],
20:38:39.820 warnings: []
20:38:39.820 }
1***@163.com
请问你是咋解决的,我实在找不到是哪里错了
2023-08-18 16:57
小孩子才选
回复 1***@163.com: 你去看看源码就一目了然了,他应该是做了taro的适配,存在与uniapp不符合的条件编译。他的dist文件夹中有许多文件,你找一个没有条件编译的作为包的入口文件就行
2023-11-20 18:53
小孩子才选
回复 1***@163.com: 最笨的就是将其条件编译相关注释删除了就好了
2023-11-20 18:54
夫子仰慕者
你的问题解决了吗
2024-07-29 17:31