1
1
import type webpack from 'webpack'
2
2
3
- type LoaderTest = ( l : { path : string , ident ?: string } ) => boolean
3
+ type LoaderTest = ( l : { path : string ; ident ?: string } ) => boolean
4
4
5
- const templatePitcherTest : LoaderTest = l => / ( \/ | \\ | @ ) w i n d i c s s - t e m p l a t e / . test ( l . path )
6
- const windiPitcherTest : LoaderTest = l => / ( \/ | \\ | @ ) w i n d i c s s - s t y l e - p i t c h e r / . test ( l . path )
7
- const postCssLoaderTest : LoaderTest = l => / ( \/ | \\ | @ ) p o s t c s s - l o a d e r / . test ( l . path )
8
- const cssLoaderTest : LoaderTest = l => / ( \/ | \\ | @ ) c s s - l o a d e r / . test ( l . path )
5
+ const templatePitcherTest : LoaderTest = l => / ( \/ | \\ | @ ) w i n d i c s s - t e m p l a t e / . test ( l . path )
6
+ const windiPitcherTest : LoaderTest = l => / ( \/ | \\ | @ ) w i n d i c s s - s t y l e - p i t c h e r / . test ( l . path )
7
+ const postCssLoaderTest : LoaderTest = l => / ( \/ | \\ | @ ) p o s t c s s - l o a d e r / . test ( l . path )
8
+ const cssLoaderTest : LoaderTest = l => / ( \/ | \\ | @ ) c s s - l o a d e r / . test ( l . path )
9
9
10
10
/*
11
11
* Move the position of the transform-template loader for Vue SFCs.
12
12
*
13
13
* We move it just after the PostCSS loader
14
14
*/
15
15
export const pitch = function ( this : webpack . loader . LoaderContext , remainingRequest : string ) {
16
-
17
16
const findLoaderIndex = ( test : LoaderTest ) => this . loaders . findIndex ( test )
18
17
/**
19
18
* Removes a loader recursively from the request and returns a found instance
20
19
* @param test
21
20
*/
22
- const removeLoader : ( test : LoaderTest ) => any = ( test ) => {
21
+ const removeLoader : ( test : LoaderTest ) => any = ( test ) => {
23
22
let index , loader
24
23
while ( ( index = findLoaderIndex ( test ) ) !== - 1 ) {
25
24
loader = this . loaders [ index ]
@@ -38,7 +37,6 @@ export const pitch = function(this: webpack.loader.LoaderContext, remainingReque
38
37
return
39
38
}
40
39
41
-
42
40
let newTemplateLoaderIndex = findLoaderIndex ( postCssLoaderTest )
43
41
// just in-case they don't have post-css for whatever reason we also search for the css-loader
44
42
if ( newTemplateLoaderIndex === - 1 )
0 commit comments