vue-loader
vue-loader copied to clipboard
Invalid path for sourcemap
What problem does this feature solve?
Path in sourcemap don't match with real path.
What does the proposed API look like?
Actualy :
Expected :
Why you don't use full path in lib/index.js (63-73) ?
const filename = path.basename(resourcePath)
const context = rootContext || process.cwd()
const sourceRoot = path.dirname(path.relative(context, resourcePath))
const descriptor = parse({
source,
compiler: options.compiler || loadTemplateCompiler(loaderContext),
filename,
sourceRoot,
needMap: sourceMap
})
should be
const filename = resourcePath
const context = rootContext || process.cwd()
const sourceRoot = path.dirname(path.relative(context, resourcePath))
const descriptor = parse({
source,
compiler: options.compiler || loadTemplateCompiler(loaderContext),
filename,
sourceRoot,
needMap: sourceMap
})
or
const filename = path.basename(resourcePath)
const context = rootContext || process.cwd()
const sourceRoot = path.dirname(path.relative(context, resourcePath))
const descriptor = parse({
source,
compiler: options.compiler || loadTemplateCompiler(loaderContext),
filename: resourcePath,
sourceRoot,
needMap: sourceMap
})
+1
I think there probably should ` const { target, request, minimize, sourceMap, rootContext, resourcePath, resourceQuery = '' } = loaderContext
... const descriptor = parse({ source, compiler: options.compiler || loadTemplateCompiler(loaderContext), filename: request, needMap: sourceMap })`
becase if we ues resourcePath style will use the same filename with script
I have the same problem!
I think there probably should ` const { target, request, minimize, sourceMap, rootContext, resourcePath, resourceQuery = '' } = loaderContext
... const descriptor = parse({ source, compiler: options.compiler || loadTemplateCompiler(loaderContext), filename: request, needMap: sourceMap })`
becase if we ues resourcePath style will use the same filename with script
Your solution seems to work!
我认为可能应该
const {target,request,minimize,sourceMap,rootContext,resourcePath,resourceQuery =''} = loaderContext ... const 描述符 = parse({ 源, 编译器: options.compiler || loadTemplateCompiler(loaderContext), 文件名: request, needMap: sourceMap })
因为如果我们使用resourcePath样式将使用与脚本相同的文件名您的解决方案似乎有效!
这个具体要怎么进行修改
@kiraraty
把filename改为request
@kiraraty
把filename改为request
对应vue-loader版本多少,谢谢
@kiraraty vue2我用的15.10.1