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

Named Webpack chunks of PDF.js #274

Closed
ccorcos opened this issue Sep 14, 2018 · 6 comments
Closed

Named Webpack chunks of PDF.js #274

ccorcos opened this issue Sep 14, 2018 · 6 comments
Assignees
Labels
invalid This doesn't seem right question Further information is requested

Comments

@ccorcos
Copy link

ccorcos commented Sep 14, 2018

It would be nice if the webpack chunks created by this project were named so I can handle them separately.

@ccorcos
Copy link
Author

ccorcos commented Sep 14, 2018

Current names are:

3-b04cd683fded9adeb39f.js
4-cec33cb028f053c8861e.js
9e0e2a90ddf92457636e.worker.js
vendors~pdf-2f6389aff856401fb70c.js

@wojtekmaj
Copy link
Owner

Hello,
this project does not create any chunks. Your Webpack does. All React-PDF does is providing you with the modules, to bundle with whatever tool you prefer. How your chunks are called is controlled by output.chunkFilename.

@wojtekmaj wojtekmaj self-assigned this Sep 15, 2018
@wojtekmaj wojtekmaj added the question Further information is requested label Sep 15, 2018
@ccorcos
Copy link
Author

ccorcos commented Sep 18, 2018

In my code, I have await import(/* webpackChunkName: "pdf" */ "react-pdf/dist/entry.webpack") which does generates a pdf-xxxxxxxxxxxxxxxxxxxx.js file. But I'm also seeing these other four. My chunkFilename setting is "[name]-[chunkhash].js" so the webpack entry appears to be missing names for these other four files. That said, I'm not entirely sure how this project is supposed to work.

@wojtekmaj
Copy link
Owner

I'm afraid these are the chunks created by Mozilla's PDF.js which is our dependency. They shouldn't use Webpack magic comments though in case someone else would use the same webpackChunkName. So in this case it's best to use it as it is. You could also fork PDF.js and add your magic comments there, but I doubt if it's worth it.

@ccorcos
Copy link
Author

ccorcos commented Sep 19, 2018

Well you could create really specific magic comments that won't ever collide. Just something so I can reliably use a regex to move these files somewhere else. If I add another chunk, the mozilla chunks may end up turning into 5 and 6 making my code brittle and unreliable.

@wojtekmaj
Copy link
Owner

I agree that it might be an issue. Maybe it will be worth discussing with Mozilla on their page?

@wojtekmaj wojtekmaj added the invalid This doesn't seem right label Oct 2, 2018
@wojtekmaj wojtekmaj changed the title Named webpack chunks Named Webpack chunks of PDF.js Oct 2, 2018
alexandernanberg pushed a commit to alexandernanberg/react-pdf that referenced this issue Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants