diff --git a/lib/select.js b/lib/select.js index 114adbd43..6afa9e6e4 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.lang || 'html') 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, 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}/ ) })