Skip to content

feat: #1371 Append the file extension to the mapping files in devtools #1372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 16, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.type || 'template')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be descriptor.template.lang

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yyx990803 Changed to descriptor.template.lang || 'html' (I think the default type should be 'html'?) in the new commit. But should we switch to the != solution for it looks much better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That involves a bigger refactor and likely a new major version.

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}/
)
})