@@ -140,25 +140,25 @@ function src2destRelative (srcRelative: string, isPublish?: boolean) {
140140
141141 // node_modules => dist/npm/wxcs
142142 // path/node_modules => path/npm/wxcs
143- destRelative = destRelative . replace ( new RegExp ( `(^|\/ )${ config . npm . src } ` , 'ig' ) , ( match , $1 ) => {
143+ destRelative = destRelative . replace ( new RegExp ( `(^|\\ ${ path . sep } )${ config . npm . src } ` , 'ig' ) , ( match , $1 ) => {
144144 // let npm = ext === config.ext.wxc ? config.npm.dest.wxcs : config.npm.dest.modules
145145 let npmDest = config . npm . dest
146146
147147 if ( $1 === '' ) {
148148 // node_modules => dist/npm/wxcs
149149 // node_modules => dist/npm/modules
150150 return npmDest
151- } else if ( $1 === '/' ) {
151+ } else if ( $1 === path . sep ) {
152152 // path/node_modules => path/npm/wxcs
153153 // path/node_modules => path/npm/modules
154- return npmDest . split ( '/' ) . slice ( 1 ) . join ( '/' )
154+ return npmDest . split ( path . sep ) . slice ( 1 ) . join ( path . sep )
155155 } else {
156156 return match
157157 }
158158 } )
159159
160160 // /wxc-hello/src/ => /wxc-hello/dist/
161- destRelative = destRelative . replace ( new RegExp ( `(/ ${ config . prefix } [a-z-]+/ )([a-z]+)` ) , ( match , $1 , $2 ) => {
161+ destRelative = destRelative . replace ( new RegExp ( `(${ path . sep } ${ config . prefix } [a-z-]+\\ ${ path . sep } )([a-z]+)` ) , ( match , $1 , $2 ) => {
162162 if ( $2 === config . package . src ) {
163163 return `${ $1 } ${ config . package . dest } `
164164 }
@@ -332,13 +332,13 @@ function resolveLookupNpmPaths (parent: string) {
332332 let relPath = path . relative ( config . cwd , parent )
333333
334334 // 相对路径起始不包含 node_modules 或 source/packages,返回默认
335- if ( ! new RegExp ( `^(node_modules|${ config . packages } )/ ` ) . test ( relPath ) ) {
335+ if ( ! new RegExp ( `^(node_modules|${ config . packages } )\\ ${ path . sep } ` ) . test ( relPath ) ) {
336336 return paths
337337 }
338338
339339 // ['node_modules', '@scope', 'wxc-hello']
340340 // ['source', 'packages', 'wxc-hello']
341- let spes = relPath . split ( '/' )
341+ let spes = relPath . split ( path . sep )
342342
343343 for ( let i = 0 ; i < spes . length ; i ++ ) {
344344 let name = spes [ i ]
@@ -348,7 +348,7 @@ function resolveLookupNpmPaths (parent: string) {
348348 continue
349349 }
350350
351- let lookup = spes . slice ( 0 , i + 1 ) . join ( '/' )
351+ let lookup = spes . slice ( 0 , i + 1 ) . join ( path . sep )
352352
353353 // 'source'
354354 // 'source/packages'
0 commit comments