Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

fix: request in data loader #662

Merged
merged 8 commits into from
Nov 7, 2022
Merged

Conversation

chenjun1011
Copy link
Contributor

fix: #600

@vercel
Copy link

vercel bot commented Nov 4, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
ice-v3 ✅ Ready (Inspect) Visit Preview Nov 4, 2022 at 9:54AM (UTC)

@@ -45,7 +45,7 @@ export default class DataLoaderPlugin {
},
{
swc: {
keepExports: ['getData', 'getAppData'],
keepExports: ['getData', 'getAppData', 'request'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个配置能做到移除 src/app 的其他导出,包括立即执行么?另外可以在插件上增加一个配置,不一定耦合 request

},
};

if (runtimeModules) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个是干啥的?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

通过插件注册的一些运行时模块,比如 request 插件,会配置请求的 baseUrl,需要对 data-loader 生效


<% if(!dataLoaderImport.imports) {-%>
let fetcher = (options) => {
window.fetch(options.url, options);
}
<% } -%>

dataLoader.init(loaders, fetcher);
const statics = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在命名上可以明确掉是运行时模式

// Only init static runtime in data-loader.
const staticRuntimes = [

@ClarkXia ClarkXia added urgent and removed urgent labels Nov 4, 2022
@answershuto answershuto merged commit 7c07270 into release-next Nov 7, 2022
@answershuto answershuto deleted the fix-request-in-data-loader branch November 7, 2022 02:39
@ClarkXia ClarkXia mentioned this pull request Nov 7, 2022
15 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants