Fix loading resources from CDN
This commit is contained in:
parent
92dbca70d4
commit
50e855bb71
@ -19,6 +19,6 @@ class Webpack
|
||||
|
||||
public function __get($path)
|
||||
{
|
||||
return url('app').'/'.Arr::get($this->manifest, $path, '');
|
||||
return Arr::get($this->manifest, $path, '');
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,9 @@ if (! function_exists('webpack_assets')) {
|
||||
return "http://127.0.0.1:8080/public/$relativeUri";
|
||||
// @codeCoverageIgnoreEnd
|
||||
} else {
|
||||
$path = app('webpack')->$relativeUri;
|
||||
$cdn = option('cdn_address');
|
||||
return $cdn ? "$cdn/app/$relativeUri" : app('webpack')->$relativeUri;
|
||||
return $cdn ? "$cdn/app/$path" : url("/app/$path");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ class AdminControllerTest extends BrowserKitTestCase
|
||||
$this->assertFalse(option('auto_detect_asset_url'));
|
||||
$this->assertTrue(option('return_204_when_notfound'));
|
||||
$this->assertEquals('0', option('cache_expire_time'));
|
||||
$this->visit('/')->see('url/app/index.js');
|
||||
$this->visit('/')->see('url/app/');
|
||||
|
||||
$this->visit('/admin/resource')
|
||||
->type('', 'cdn_address')
|
||||
|
@ -12,6 +12,6 @@ class WebpackTest extends TestCase
|
||||
File::shouldReceive('exists')->andReturn(true);
|
||||
File::shouldReceive('get')->andReturn(json_encode(['a' => 'b']));
|
||||
$key = 'a';
|
||||
$this->assertEquals('http://localhost/app/b', app('webpack')->$key);
|
||||
$this->assertEquals('b', app('webpack')->$key);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user