Commit 0c2da0f5 authored by Jianrong Yu's avatar Jianrong Yu Committed by Evan You

feat: append the file extension to the mapping files in devtools (#1372)

close #1371
parent cd17d05e
module.exports = function selectBlock (descriptor, loaderContext, query) { module.exports = function selectBlock (descriptor, loaderContext, query) {
// template // template
if (query.type === `template`) { if (query.type === `template`) {
loaderContext.resourcePath += '.' + (descriptor.template.lang || 'html')
loaderContext.callback( loaderContext.callback(
null, null,
descriptor.template.content, descriptor.template.content,
...@@ -11,6 +12,7 @@ module.exports = function selectBlock (descriptor, loaderContext, query) { ...@@ -11,6 +12,7 @@ module.exports = function selectBlock (descriptor, loaderContext, query) {
// script // script
if (query.type === `script`) { if (query.type === `script`) {
loaderContext.resourcePath += '.' + (descriptor.script.lang || 'js')
loaderContext.callback( loaderContext.callback(
null, null,
descriptor.script.content, descriptor.script.content,
...@@ -22,6 +24,7 @@ module.exports = function selectBlock (descriptor, loaderContext, query) { ...@@ -22,6 +24,7 @@ module.exports = function selectBlock (descriptor, loaderContext, query) {
// styles // styles
if (query.type === `style` && query.index != null) { if (query.type === `style` && query.index != null) {
const style = descriptor.styles[query.index] const style = descriptor.styles[query.index]
loaderContext.resourcePath += '.' + (style.lang || 'css')
loaderContext.callback( loaderContext.callback(
null, null,
style.content, style.content,
......
...@@ -179,6 +179,6 @@ test('CSS Modules', async () => { ...@@ -179,6 +179,6 @@ test('CSS Modules', async () => {
// custom ident // custom ident
await testWithIdent( await testWithIdent(
'[path][name]---[local]---[hash:base64:5]', '[path][name]---[local]---[hash:base64:5]',
/css-modules---red---\w{5}/ /css-modules-vue---red---\w{5}/
) )
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment