Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vue-loader
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pi-plusplus
fork-from-github
vue-loader
Commits
f0beed32
Commit
f0beed32
authored
Aug 26, 2018
by
Evan You
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: hide ext appending behind a flag (ref #1372)
parent
5a7d56d7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
6 deletions
+22
-6
index.js
lib/index.js
+6
-1
select.js
lib/select.js
+15
-4
style.spec.js
test/style.spec.js
+1
-1
No files found.
lib/index.js
View file @
f0beed32
...
...
@@ -72,7 +72,12 @@ module.exports = function (source) {
// e.g. foo.vue?type=template&id=xxxxx
// and we will return early
if
(
incomingQuery
.
type
)
{
return
selectBlock
(
descriptor
,
loaderContext
,
incomingQuery
)
return
selectBlock
(
descriptor
,
loaderContext
,
incomingQuery
,
!!
options
.
appendExtension
)
}
// module id for scoped CSS & hot-reload
...
...
lib/select.js
View file @
f0beed32
module
.
exports
=
function
selectBlock
(
descriptor
,
loaderContext
,
query
)
{
module
.
exports
=
function
selectBlock
(
descriptor
,
loaderContext
,
query
,
appendExtension
)
{
// template
if
(
query
.
type
===
`template`
)
{
if
(
appendExtension
)
{
loaderContext
.
resourcePath
+=
'.'
+
(
descriptor
.
template
.
lang
||
'html'
)
}
loaderContext
.
callback
(
null
,
descriptor
.
template
.
content
,
...
...
@@ -12,7 +19,9 @@ module.exports = function selectBlock (descriptor, loaderContext, query) {
// script
if
(
query
.
type
===
`script`
)
{
if
(
appendExtension
)
{
loaderContext
.
resourcePath
+=
'.'
+
(
descriptor
.
script
.
lang
||
'js'
)
}
loaderContext
.
callback
(
null
,
descriptor
.
script
.
content
,
...
...
@@ -24,7 +33,9 @@ module.exports = function selectBlock (descriptor, loaderContext, query) {
// styles
if
(
query
.
type
===
`style`
&&
query
.
index
!=
null
)
{
const
style
=
descriptor
.
styles
[
query
.
index
]
if
(
appendExtension
)
{
loaderContext
.
resourcePath
+=
'.'
+
(
style
.
lang
||
'css'
)
}
loaderContext
.
callback
(
null
,
style
.
content
,
...
...
test/style.spec.js
View file @
f0beed32
...
...
@@ -179,6 +179,6 @@ test('CSS Modules', async () => {
// custom ident
await
testWithIdent
(
'[path][name]---[local]---[hash:base64:5]'
,
/css-modules-
vue-
--red---
\w{5}
/
/css-modules---red---
\w{5}
/
)
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment