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

replace id with name in chunk files, Fix #996 #997

Merged
merged 1 commit into from
Nov 8, 2017

Conversation

SidKwok
Copy link
Contributor

@SidKwok SidKwok commented Oct 20, 2017

Use id to name the chunk files will lost the webpackChunkName somehow. But replace it with name will solve this issue.

code:

const MainView = () => import(/* webpackChunkName: "group-foo" */ '@/components/MainView')
const OneView = () => import(/* webpackChunkName: "group-foo" */ '@/components/OneView')
const TwoView = () => import(/* webpackChunkName: "group-foo" */ '@/components/TwoView')

use id:
1508482209806

use name:
1508482776777

without using any magic comments and it will fallback to id:
1508482833874

@LinusBorg
Copy link
Contributor

Thanks!

@SidKwok
Copy link
Contributor Author

SidKwok commented Nov 9, 2017

Happy to help ! :)

@c0defre4k
Copy link
Contributor

As mentioned in my comment in #996 this leads to bigger JavaScript code.

Note that these filenames need to be generated at runtime to send the requests for chunks. Because of this, placeholders like [name] and [chunkhash] need to add a mapping from chunk id to placeholder value to the output bundle with the webpack runtime. This increases the size and may invalidate the bundle when placeholder value for any chunk changes.

shenron pushed a commit to shenron/webpack that referenced this pull request Mar 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants