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
be2384c2
Commit
be2384c2
authored
Jul 17, 2018
by
Evan You
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: support usage with other loaders with enforce: post
fix #1351
parent
791999a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
6 deletions
+36
-6
pitcher.js
lib/loaders/pitcher.js
+6
-4
edgeCases.spec.js
test/edgeCases.spec.js
+30
-2
No files found.
lib/loaders/pitcher.js
View file @
be2384c2
...
@@ -14,14 +14,16 @@ module.exports.pitch = function (remainingRequest) {
...
@@ -14,14 +14,16 @@ module.exports.pitch = function (remainingRequest) {
const
{
cacheDirectory
,
cacheIdentifier
}
=
options
const
{
cacheDirectory
,
cacheIdentifier
}
=
options
const
query
=
qs
.
parse
(
this
.
resourceQuery
.
slice
(
1
))
const
query
=
qs
.
parse
(
this
.
resourceQuery
.
slice
(
1
))
let
loaders
=
this
.
loaders
// if this is a language block request, remove eslint-loader to avoid
// if this is a language block request, remove eslint-loader to avoid
// duplicate linting.
// duplicate linting.
const
loaders
=
query
.
type
if
(
query
.
type
)
{
?
this
.
loaders
.
filter
(
l
=>
!
/
(\/
|
\\
|@
)
eslint-loader/
.
test
(
l
.
path
))
loaders
=
loaders
.
filter
(
l
=>
!
/
(\/
|
\\
|@
)
eslint-loader/
.
test
(
l
.
path
))
:
this
.
loaders
}
// remove self
// remove self
loaders
.
shift
(
)
loaders
=
loaders
.
filter
(
l
=>
l
.
path
!==
__filename
)
// do not inject if user uses null-loader to void the type (#1239)
// do not inject if user uses null-loader to void the type (#1239)
if
(
loaders
.
some
(
l
=>
/
(\/
|
\\
|@
)
null-loader/
.
test
(
l
.
path
)))
{
if
(
loaders
.
some
(
l
=>
/
(\/
|
\\
|@
)
null-loader/
.
test
(
l
.
path
)))
{
...
...
test/edgeCases.spec.js
View file @
be2384c2
...
@@ -9,7 +9,11 @@ const {
...
@@ -9,7 +9,11 @@ const {
mockBundleAndRun
mockBundleAndRun
}
=
require
(
'./utils'
)
}
=
require
(
'./utils'
)
const
assertComponent
=
({
window
,
module
},
done
)
=>
{
const
assertComponent
=
({
window
,
module
,
expectedMsg
=
'Hello from Component A!'
},
done
)
=>
{
if
(
typeof
module
===
'function'
)
{
if
(
typeof
module
===
'function'
)
{
module
=
module
.
options
module
=
module
.
options
}
}
...
@@ -23,7 +27,7 @@ const assertComponent = ({ window, module }, done) => {
...
@@ -23,7 +27,7 @@ const assertComponent = ({ window, module }, done) => {
expect
(
vnode
.
data
.
staticClass
).
toBe
(
'red'
)
expect
(
vnode
.
data
.
staticClass
).
toBe
(
'red'
)
expect
(
vnode
.
children
[
0
].
text
).
toBe
(
'hi'
)
expect
(
vnode
.
children
[
0
].
text
).
toBe
(
'hi'
)
expect
(
module
.
data
().
msg
).
toContain
(
'Hello from Component A!'
)
expect
(
module
.
data
().
msg
).
toContain
(
expectedMsg
)
let
style
=
window
.
document
.
querySelector
(
'style'
).
textContent
let
style
=
window
.
document
.
querySelector
(
'style'
).
textContent
style
=
normalizeNewline
(
style
)
style
=
normalizeNewline
(
style
)
expect
(
style
).
toContain
(
'comp-a h2 {
\
n color: #f00;
\
n}'
)
expect
(
style
).
toContain
(
'comp-a h2 {
\
n color: #f00;
\
n}'
)
...
@@ -184,3 +188,27 @@ test('proper dedupe on src-imports with options', done => {
...
@@ -184,3 +188,27 @@ test('proper dedupe on src-imports with options', done => {
}
}
},
res
=>
assertComponent
(
res
,
done
))
},
res
=>
assertComponent
(
res
,
done
))
})
})
// #1351
test
(
'use with postLoader'
,
done
=>
{
mockBundleAndRun
({
entry
:
'basic.vue'
,
module
:
{
rules
:
[
{
test
:
/
\.
js$/
,
use
:
{
loader
:
require
.
resolve
(
'./mock-loaders/js'
)
},
enforce
:
'post'
}
]
}
},
({
window
,
module
})
=>
{
assertComponent
({
window
,
module
,
expectedMsg
:
'Changed!'
},
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