diff --git a/plugins/webpack-fui-worker-plugin/worker-loader.js b/plugins/webpack-fui-worker-plugin/worker-loader.js index 556bb6056..23be31927 100644 --- a/plugins/webpack-fui-worker-plugin/worker-loader.js +++ b/plugins/webpack-fui-worker-plugin/worker-loader.js @@ -115,16 +115,18 @@ function loader() { null, // 插入代码的转译和压缩由主构建配置的 babel/ts loader 处理, 不需要 worker-worker 来处理 // 添加 @ts-nocheck 避免 ts-check 报错 + // 修复export const 下 const不会被转译的问题 `// @ts-nocheck const blob = new Blob([${JSON.stringify(compilation.assets[entry].source())}]); - export const workerUrl = window.URL.createObjectURL(blob); + const workerUrl = window.URL.createObjectURL(blob); + export default workerUrl; ` ) : callback( null, `// @ts-nocheck const servicePath = __webpack_public_path__ + ${JSON.stringify(entry)}; - export const workerUrl = servicePath; + export default servicePath; ` ) });