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

Build creates 2.[hash].chunk.js instead of 1.[hash].chunk.js #6698

Closed
robcaldecottvelo opened this issue Mar 21, 2019 · 3 comments · Fixed by #6786
Closed

Build creates 2.[hash].chunk.js instead of 1.[hash].chunk.js #6698

robcaldecottvelo opened this issue Mar 21, 2019 · 3 comments · Fixed by #6786

Comments

@robcaldecottvelo
Copy link

robcaldecottvelo commented Mar 21, 2019

Is this a bug report?

Yes

Did you try recovering your dependencies?

This is not a dependency issue.

Which terms did you search for in User Guide?

"chunk"

Environment

  System:
    OS: macOS 10.14.3
    CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
  Binaries:
    Node: 11.12.0 - /usr/local/bin/node
    Yarn: 1.15.2 - /usr/local/bin/yarn
    npm: 6.7.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 73.0.3683.86
    Firefox: 65.0.1
    Safari: 12.0.3
  npmPackages:
    react: Not Found
    react-dom: Not Found
    react-scripts: Not Found
  npmGlobalPackages:
    create-react-app: Not Found

Steps to Reproduce

We are upgrading from react-scripts 2.1.1 which used to generate a files called 1.[hash].chunk.js and 1.[hash].chunk.css. This has now changed to 2.[hash].chunk.*. While this would not be an issue for most, we are integrating with some legacy code where we are expecting 1.[hash].chunk.* to be present.

Note that 2.[hash].chunk.* contradicts the official docs here:

https://facebook.github.io/create-react-app/docs/production-build#docsNav

  1. Create a new app via create-react-app
  2. Run npm build or yarn build
  3. Observe that 2.[hash].chunk.js is created instead of 1.[hash].chunk.js

Expected Behavior

We expected 1.[hash].chunk.js

Actual Behavior

Production build JS files are not named correctly.

@robcaldecottvelo robcaldecottvelo changed the title Build is created 2.[hash].chunk.js instead of 1.[hash].chunk.js Build creates 2.[hash].chunk.js instead of 1.[hash].chunk.js Mar 21, 2019
@ianschmitz
Copy link
Contributor

You're correct that the docs describe a very specific output. I think we could improve the docs to be less specific rather than saying that there are exactly those 3 files emitted. The original intent was to give a little insight into why multiple files are created and what might be in them.

To rely on those exact file names (1.[hash]...) will likely cause issues as our dependencies change over time and is not something we recommend.

If somebody would like to submit a PR for the docs to broaden the the naming of the files as well as indicate that the names are not set in stone that would be great!

@delaaxe
Copy link

delaaxe commented Apr 2, 2019

Why not rename the vendor code to vendor.[hash].chunk.js?

@ianschmitz
Copy link
Contributor

There can be multiple vendor chunks.

bakuzan added a commit to bakuzan/create-react-app that referenced this issue Apr 10, 2019
@lock lock bot locked and limited conversation to collaborators Apr 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants