Skip to content

Commit 1371455

Browse files
oneyouziyucongshuang
andauthored
ide下设置devtool为inline-source-map模式在调试模式下生成的源文件路径不对 (#84)
* fix: ide设置成inline-source-map生成的文件没有源文件 fix:ide传过来的项目地址是小写开发 fix:屏蔽colorconsole.attach(options.log) * fix: 删掉不必要的打印信息 * fix: ide编译的source-map源文件路径不对,修改webpack devtool产物做了适配 * fix:格式修改 * fix:格式修改 --------- Co-authored-by: yucongshuang <[email protected]>
1 parent 3f56a60 commit 1371455

File tree

1 file changed

+13
-1
lines changed
  • packages/hap-toolkit/src/gen-webpack-conf

1 file changed

+13
-1
lines changed

packages/hap-toolkit/src/gen-webpack-conf/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,19 @@ export default async function genWebpackConf(launchOptions, mode) {
211211
globalObject: 'window',
212212
path: BUILD_DIR,
213213
filename: '[name].js',
214-
publicPath: '/'
214+
publicPath: '/',
215+
devtoolModuleFilenameTemplate: (info) => {
216+
let resPath = info.resourcePath
217+
let namespace = info.namespace
218+
// ide打包分情况生成的路径不对 "E:\\work\\ide-new\\.build\\electron\\D:\\Users\\Desktop\\1_quickapp-code-21\\src\\app.ux",需要换成'.src/app.ux'
219+
if (resPath.indexOf('electron') !== -1) {
220+
// 拿到src及以后的并将\\换成/
221+
const src = resPath.split(namespace)[1].replace(/\\/g, '/')
222+
return `webpack://${namespace}/${resPath.replace(resPath, '.' + src)}`
223+
}
224+
// 默认返回
225+
return `webpack://${namespace}/${resPath}?${info.hash}`
226+
}
215227
},
216228
module: {
217229
rules: [

0 commit comments

Comments
 (0)