Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config code split #562

Merged
merged 6 commits into from
Jan 7, 2018
Merged

Config code split #562

merged 6 commits into from
Jan 7, 2018

Conversation

afc163
Copy link
Member

@afc163 afc163 commented Jan 3, 2018

Use https://github.com/seeden/babel-plugin-dynamic-import-node-sync

Defaultly, app would be bundled as one file.

The code split will works if you remove dynamic-import-node-sync in .roadhogrc.


close #470
close #524

@chenshuai2144
Copy link
Collaborator

这个插件简直完美。。我去膜拜一下

const dynamicWrapper = (app, models, component) => {
// () => require('module')
// transformed by babel-plugin-dynamic-import-node-sync
if (component.toString().indexOf('.then(') < 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个判断的意义是什么?

Copy link
Member Author

@afc163 afc163 Jan 3, 2018

Choose a reason for hiding this comment

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

区别是 () => import('module') 还是转换过的 () => require('module')。目前没有找到更好的方案。

Copy link
Collaborator

Choose a reason for hiding this comment

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

希望webpack未来出一个api,实现的感觉还是打补丁的感觉

@afc163
Copy link
Member Author

afc163 commented Jan 3, 2018

  • 没问题了我再补个文档。

afc163 referenced this pull request in ant-design/ant-design-pro-site Jan 5, 2018
@chenshuai2144
Copy link
Collaborator

chenshuai2144 commented Jan 5, 2018

你为什么能通过ci检查?

@afc163 afc163 merged commit 61c60a2 into master Jan 7, 2018
@afc163 afc163 deleted the config-code-split branch January 7, 2018 10:09
@ddcat1115 ddcat1115 mentioned this pull request Jan 8, 2018
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow dynamic route and code split configable
2 participants