Skip to content

Commit

Permalink
feat: append the file extension to the mapping files in devtools (#1372)
Browse files Browse the repository at this point in the history
close #1371
  • Loading branch information
YuJianrong authored and yyx990803 committed Aug 16, 2018
1 parent cd17d05 commit 0c2da0f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/select.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = function selectBlock (descriptor, loaderContext, query) {
// template
if (query.type === `template`) {
loaderContext.resourcePath += '.' + (descriptor.template.lang || 'html')
loaderContext.callback(
null,
descriptor.template.content,
Expand All @@ -11,6 +12,7 @@ module.exports = function selectBlock (descriptor, loaderContext, query) {

// script
if (query.type === `script`) {
loaderContext.resourcePath += '.' + (descriptor.script.lang || 'js')
loaderContext.callback(
null,
descriptor.script.content,
Expand All @@ -22,6 +24,7 @@ module.exports = function selectBlock (descriptor, loaderContext, query) {
// styles
if (query.type === `style` && query.index != null) {
const style = descriptor.styles[query.index]
loaderContext.resourcePath += '.' + (style.lang || 'css')
loaderContext.callback(
null,
style.content,
Expand Down
2 changes: 1 addition & 1 deletion test/style.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,6 @@ test('CSS Modules', async () => {
// custom ident
await testWithIdent(
'[path][name]---[local]---[hash:base64:5]',
/css-modules---red---\w{5}/
/css-modules-vue---red---\w{5}/
)
})

0 comments on commit 0c2da0f

Please sign in to comment.