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
731a7ad1
Commit
731a7ad1
authored
Feb 28, 2019
by
David Guilherme
Committed by
Evan You
Feb 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support post loaders for template blocks (#1500)
parent
4909b170
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
pitcher.js
lib/loaders/pitcher.js
+8
-1
template.spec.js
test/template.spec.js
+19
-0
No files found.
lib/loaders/pitcher.js
View file @
731a7ad1
...
...
@@ -10,6 +10,8 @@ const isNullLoader = l => /(\/|\\|@)null-loader/.test(l.path)
const
isCSSLoader
=
l
=>
/
(\/
|
\\
|@
)
css-loader/
.
test
(
l
.
path
)
const
isCacheLoader
=
l
=>
/
(\/
|
\\
|@
)
cache-loader/
.
test
(
l
.
path
)
const
isPitcher
=
l
=>
l
.
path
!==
__filename
const
isPreLoader
=
l
=>
!
l
.
pitchExecuted
const
isPostLoader
=
l
=>
l
.
pitchExecuted
const
dedupeESLintLoader
=
loaders
=>
{
const
res
=
[]
...
...
@@ -136,10 +138,15 @@ module.exports.pitch = function (remainingRequest) {
cacheIdentifier
:
hash
(
cacheIdentifier
)
+
'-vue-loader-template'
})}
`
]
:
[]
const
preLoaders
=
loaders
.
filter
(
isPreLoader
)
const
postLoaders
=
loaders
.
filter
(
isPostLoader
)
const
request
=
genRequest
([
...
cacheLoader
,
...
postLoaders
,
templateLoaderPath
+
`??vue-loader-options`
,
...
l
oaders
...
preL
oaders
])
// console.log(request)
// the template compiler uses esm exports
...
...
test/template.spec.js
View file @
731a7ad1
...
...
@@ -305,3 +305,22 @@ test('disable prettify', done => {
done
()
})
})
test
(
'postLoaders support'
,
done
=>
{
mockBundleAndRun
({
entry
:
'basic.vue'
,
module
:
{
rules
:
[
{
resourceQuery
:
/^
\?
vue&type=template/
,
enforce
:
'post'
,
loader
:
path
.
resolve
(
__dirname
,
'./mock-loaders/html'
)
}
]
}
},
({
module
})
=>
{
// class="red" -> { staticClass: "red" } -> { staticClass: "green" }
expect
(
module
.
render
.
toString
()).
toMatch
(
`green`
)
done
()
})
})
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