Skip to content

Commit 0c2da0f

Browse files
YuJianrongyyx990803
authored andcommitted
feat: append the file extension to the mapping files in devtools (#1372)
close #1371
1 parent cd17d05 commit 0c2da0f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Diff for: lib/select.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module.exports = function selectBlock (descriptor, loaderContext, query) {
22
// template
33
if (query.type === `template`) {
4+
loaderContext.resourcePath += '.' + (descriptor.template.lang || 'html')
45
loaderContext.callback(
56
null,
67
descriptor.template.content,
@@ -11,6 +12,7 @@ module.exports = function selectBlock (descriptor, loaderContext, query) {
1112

1213
// script
1314
if (query.type === `script`) {
15+
loaderContext.resourcePath += '.' + (descriptor.script.lang || 'js')
1416
loaderContext.callback(
1517
null,
1618
descriptor.script.content,
@@ -22,6 +24,7 @@ module.exports = function selectBlock (descriptor, loaderContext, query) {
2224
// styles
2325
if (query.type === `style` && query.index != null) {
2426
const style = descriptor.styles[query.index]
27+
loaderContext.resourcePath += '.' + (style.lang || 'css')
2528
loaderContext.callback(
2629
null,
2730
style.content,

Diff for: test/style.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,6 @@ test('CSS Modules', async () => {
179179
// custom ident
180180
await testWithIdent(
181181
'[path][name]---[local]---[hash:base64:5]',
182-
/css-modules---red---\w{5}/
182+
/css-modules-vue---red---\w{5}/
183183
)
184184
})

0 commit comments

Comments
 (0)