From 60eb82d4abf71e4a68967f28686a81815f3f4145 Mon Sep 17 00:00:00 2001 From: Jianrong Yu <176076+YuJianrong@users.noreply.github.com> Date: Fri, 3 Aug 2018 20:57:20 -0700 Subject: [PATCH 1/3] feat: #1371 Append the file extension to the mapping files in devtools --- lib/select.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/select.js b/lib/select.js index 114adbd43..bdf0bfd68 100644 --- a/lib/select.js +++ b/lib/select.js @@ -1,6 +1,7 @@ module.exports = function selectBlock (descriptor, loaderContext, query) { // template if (query.type === `template`) { + loaderContext.resourcePath += '.' + (descriptor.template.type || 'template') loaderContext.callback( null, descriptor.template.content, @@ -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, @@ -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, From 98d9adfe787f045866d8e32b97afa34aca613231 Mon Sep 17 00:00:00 2001 From: Jianrong Yu <176076+YuJianrong@users.noreply.github.com> Date: Fri, 3 Aug 2018 23:27:03 -0700 Subject: [PATCH 2/3] Fix test case css-module loader will generate the module class with new file path with style extension. --- test/style.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/style.spec.js b/test/style.spec.js index 063499901..fb72a0b0d 100644 --- a/test/style.spec.js +++ b/test/style.spec.js @@ -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}/ ) }) From afb1719942b8a3be4f1bd2013f9f2df09959126f Mon Sep 17 00:00:00 2001 From: Jianrong Yu <176076+YuJianrong@users.noreply.github.com> Date: Tue, 14 Aug 2018 08:59:22 -0700 Subject: [PATCH 3/3] Update the template name Update the template name to `template.lang` and use `html` by default. --- lib/select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/select.js b/lib/select.js index bdf0bfd68..6afa9e6e4 100644 --- a/lib/select.js +++ b/lib/select.js @@ -1,7 +1,7 @@ module.exports = function selectBlock (descriptor, loaderContext, query) { // template if (query.type === `template`) { - loaderContext.resourcePath += '.' + (descriptor.template.type || 'template') + loaderContext.resourcePath += '.' + (descriptor.template.lang || 'html') loaderContext.callback( null, descriptor.template.content,