Skip to content
This repository was archived by the owner on Jan 16, 2022. It is now read-only.

Commit 5c484bb

Browse files
committed
fix: proxy webpack setting
- it allows download tarballls in the same origin - update webpack dev server - add scenario for blob
1 parent 9d006ad commit 5c484bb

File tree

5 files changed

+359
-196
lines changed

5 files changed

+359
-196
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@
9595
"webpack": "4.20.2",
9696
"webpack-bundle-analyzer": "3.3.2",
9797
"webpack-bundle-size-analyzer": "3.0.0",
98-
"webpack-cli": "3.2.3",
99-
"webpack-dev-server": "3.2.1",
98+
"webpack-cli": "3.3.6",
99+
"webpack-dev-server": "3.7.2",
100100
"webpack-merge": "4.2.1",
101101
"whatwg-fetch": "3.0.0",
102102
"xss": "1.0.6"

src/utils/api.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ function handleResponseType(response: Response): Promise<[boolean, Blob | string
1919
if (contentType.includes('text/')) {
2020
return Promise.all([response.ok, response.text()]);
2121
}
22+
23+
// unfortunatelly on download files there is no header available
24+
if (response.url.match(/tgz/).length > 0) {
25+
return Promise.all([response.ok, response.blob()]);
26+
}
2227
}
2328

2429
return Promise.resolve();
2530
}
2631

2732
class API {
28-
public request<T>(url: string, method = 'GET', options: RequestInit = { headers: {} }, isFile: boolean = false): Promise<T> {
33+
public request<T>(url: string, method = 'GET', options: RequestInit = { headers: {} }): Promise<T> {
2934
if (!window.VERDACCIO_API_URL) {
3035
throw new Error('VERDACCIO_API_URL is not defined!');
3136
}

tools/dev.server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ new WebpackDevServer(compiler, {
3232
},
3333
proxy: [
3434
{
35-
context: ['/-/verdaccio/logo', '/-/verdaccio/packages', '/-/static/logo.png'],
35+
context: ['/-/verdaccio/**', '**/*.tgz'],
3636
target: 'http://localhost:8080',
3737
},
3838
],

tools/webpack.dev.config.babel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default {
4141
scope: '',
4242
logo: 'https://verdaccio.org/img/logo/symbol/svg/verdaccio-tiny.svg',
4343
filename: 'index.html',
44-
verdaccioURL: '//localhost:8080',
44+
verdaccioURL: '//localhost:4872',
4545
template: `${env.SRC_ROOT}/template/index.html`,
4646
debug: true,
4747
inject: true,

0 commit comments

Comments
 (0)