This repository was archived by the owner on Jun 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,11 @@ export function ensureAbsolutePath(userPath: string) {
146146 return userPath ;
147147}
148148export function joinFuseBoxPath ( ...any ) : string {
149- return ensureFuseBoxPath ( path . join ( ...any ) ) ;
149+ let includesProtocol = any [ 0 ] . includes ( '://' ) ;
150+ let joinedPath = ! includesProtocol
151+ ? path . join ( ...any )
152+ : any [ 0 ] . replace ( / ( [ ^ / ] ) $ / , '$1/' ) + path . join ( ...any . slice ( 1 ) ) ;
153+ return ensureFuseBoxPath ( joinedPath ) ;
150154}
151155export function ensureDir ( userPath : string ) {
152156 if ( ! path . isAbsolute ( userPath ) ) {
Original file line number Diff line number Diff line change @@ -141,4 +141,21 @@ export class CssPluginTest {
141141 should ( result . projectContents . toString ( ) ) . findString ( `module.exports.default = "/static/92849cf0-hello.txt";` ) ;
142142 } ) ;
143143 }
144+
145+ "Should copy a file with custom resolver to external domain (hash)" ( ) {
146+ return createEnv ( {
147+ project : {
148+ hash : true ,
149+ files : {
150+ "index.ts" : `require("./hello.txt")` ,
151+ "hello.txt" : "ololo" ,
152+ } ,
153+ plugins : [ CopyPlugin ( { resolve : "https://example.com/static/" , files : [ ".txt" ] } ) ] ,
154+ instructions : "> index.ts" ,
155+ } ,
156+ } ) . then ( result => {
157+ result . shouldExistInDist ( "assets/92849cf0-hello.txt" ) ;
158+ should ( result . projectContents . toString ( ) ) . findString ( `module.exports.default = "https://example.com/static/92849cf0-hello.txt";` ) ;
159+ } ) ;
160+ }
144161}
You can’t perform that action at this time.
0 commit comments