diff --git a/docs/src/en/guide/other/faq.md b/docs/src/en/guide/other/faq.md index 76283736..da908f89 100644 --- a/docs/src/en/guide/other/faq.md +++ b/docs/src/en/guide/other/faq.md @@ -141,12 +141,19 @@ After deploying to `nginx`,you might encounter the following error: Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/octet-stream". Strict MIME type checking is enforced for module scripts per HTML spec. ``` -Solution: +Solution 1: ```bash http { + #If there is such a configuration, it needs to be commented out + #include mime.types; + types { application/javascript js mjs; } } ``` + +Solution 2: + +Open the `mime.types` file under `nginx` and change `application/javascript js;` to `application/javascript js mjs;` diff --git a/docs/src/guide/other/faq.md b/docs/src/guide/other/faq.md index 8c565538..54a74588 100644 --- a/docs/src/guide/other/faq.md +++ b/docs/src/guide/other/faq.md @@ -141,12 +141,19 @@ at Extract (vue-vben-admin-main\node_modules@purge-icons\core\dist\index.js:173: Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/octet-stream". Strict MIME type checking is enforced for module scripts per HTML spec. ``` -解决方式: +解决方式一: ```bash http { + #如果有此项配置需要注释掉 + #include mime.types; + types { application/javascript js mjs; } } ``` + +解决方式二: + +进入 `nginx` 下的`mime.types`文件, 将`application/javascript js;` 修改为 `application/javascript js mjs;` diff --git a/packages/effects/request/src/request-client/modules/downloader.ts b/packages/effects/request/src/request-client/modules/downloader.ts index 947de0b3..bf065d33 100644 --- a/packages/effects/request/src/request-client/modules/downloader.ts +++ b/packages/effects/request/src/request-client/modules/downloader.ts @@ -1,6 +1,7 @@ -import type { AxiosRequestConfig, AxiosResponse } from 'axios'; +import type { AxiosRequestConfig } from 'axios'; import type { RequestClient } from '../request-client'; +import type { RequestResponse } from '../types'; class FileDownloader { private client: RequestClient; @@ -12,13 +13,13 @@ class FileDownloader { public async download( url: string, config?: AxiosRequestConfig, - ): Promise> { + ): Promise> { const finalConfig: AxiosRequestConfig = { ...config, responseType: 'blob', }; - const response = await this.client.get>( + const response = await this.client.get>( url, finalConfig, ); diff --git a/packages/effects/request/src/request-client/types.ts b/packages/effects/request/src/request-client/types.ts index 07efd339..06ff223a 100644 --- a/packages/effects/request/src/request-client/types.ts +++ b/packages/effects/request/src/request-client/types.ts @@ -4,6 +4,8 @@ import type { InternalAxiosRequestConfig, } from 'axios'; +type RequestResponse = AxiosResponse; + type RequestContentType = | 'application/json;charset=utf-8' | 'application/octet-stream;charset=utf-8' @@ -42,6 +44,7 @@ export type { RequestClientOptions, RequestContentType, RequestInterceptorConfig, + RequestResponse, ResponseInterceptorConfig, };