File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1
1
const path = require ( 'path' ) ;
2
+ const upath = require ( 'upath' ) ;
2
3
const relative = require ( 'relative' ) ;
3
4
4
5
function MpvuePlugin ( ) { }
@@ -15,9 +16,10 @@ MpvuePlugin.prototype.apply = function(compiler) {
15
16
chunks . reverse ( ) . forEach ( chunk => {
16
17
chunk . files . forEach ( childFile => {
17
18
if ( path . extname ( childFile ) === extname && compilation . assets [ filePath ] ) {
18
- content = extname === '.wxss' ?
19
- `@import "${ relative ( filePath , childFile ) } ";\n${ content } `
20
- : `require("${ relative ( filePath , childFile ) } ");\n${ content } ` ;
19
+ const relativePath = upath . normalize ( relative ( filePath , childFile ) )
20
+ content = extname === '.wxss' ?
21
+ `@import "${ relativePath } ";\n${ content } `
22
+ : `require("${ relativePath } ");\n${ content } ` ;
21
23
}
22
24
} )
23
25
compilation . assets [ filePath ] . source = ( ) => content ;
@@ -28,4 +30,4 @@ MpvuePlugin.prototype.apply = function(compiler) {
28
30
} ) ;
29
31
} ;
30
32
31
- module . exports = MpvuePlugin ;
33
+ module . exports = MpvuePlugin ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " webpack-mpvue-asset-plugin" ,
3
- "version" : " 0.0.2 " ,
3
+ "version" : " 0.1.0 " ,
4
4
"main" : " index.js" ,
5
5
"directories" : {
6
6
"lib" : " lib"
24
24
"homepage" : " https://github.com/mpvue/webpack-mpvue-asset-plugin#readme" ,
25
25
"description" : " " ,
26
26
"dependencies" : {
27
- "relative" : " ^3.0.2"
27
+ "relative" : " ^3.0.2" ,
28
+ "upath" : " ^1.1.0"
28
29
}
29
30
}
You can’t perform that action at this time.
0 commit comments