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

How to change output filename of runtime chunk? #5358

Closed
march08 opened this issue Oct 8, 2018 · 10 comments · Fixed by #7679
Closed

How to change output filename of runtime chunk? #5358

march08 opened this issue Oct 8, 2018 · 10 comments · Fixed by #7679

Comments

@march08
Copy link

march08 commented Oct 8, 2018

currently the output is runtime~xxx.[hash].js

How do I change that? I can't make it work on cloudfront to serve files with ~ in the filename...

Example:
S3: https://s3.eu-central-1.amazonaws.com/timesheet-app.topmonks.com/static/js/runtime~main.229c360f.js Works
CF: https://timesheet-app.topmonks.com/static/js/runtime~main.229c360f.js doesn't work

Thanks a lot

Edit:
Proposed changes:

webpack.prod InlineChunkHtmlPlugin

new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime-.+[.]js/])

webpack.prod runtimeChunk

runtimeChunk: { 
    name: entrypoint => `runtime-${entrypoint.name}`,
},

Edit: seems like the cloudfront link somehow works now, anyway I would perform the change anyway as imo ~ is not the best idea for file naming.

@Timer
Copy link
Contributor

Timer commented Oct 8, 2018

This is probably a bad default name, we should replace the ~ with something else.

@Timer Timer added this to the 2.0.x milestone Oct 8, 2018
@march08
Copy link
Author

march08 commented Oct 8, 2018

This is probably a bad default name, we should replace the ~ with something else.

Mm ok, just found it here if there is anyone with the same situation.

I assume that without ejecting, I can do nothing here?

@Timer
Copy link
Contributor

Timer commented Oct 8, 2018

If your app isn't embedded in a larger app, you shouldn't need this file for your app to function. Just delete it. 😄

@march08
Copy link
Author

march08 commented Oct 8, 2018

You shouldn't need this file for your app to function. Just delete it. 😄

I would have to delete all the references from the build folder.
At this moment I receive mixes content (http(s)) and the serviceWorker is not up...

@yordis
Copy link

yordis commented Oct 11, 2018

I think we should replace it with - instead of ~.

@Timer we are embedded 😢

@Timer Timer modified the milestones: 2.1.x, 3.0 Nov 8, 2018
@pjoe
Copy link

pjoe commented Jan 25, 2019

Having the same issue. Who came up with putting ~ in the file name 😮

Filenames should only contain 1 and 0 😛

@iansu iansu modified the milestones: 3.0, 3.x Mar 10, 2019
@adamplabarge
Copy link

adamplabarge commented Apr 19, 2019

+1 for changing the ~ to something else. . -_ would all be better options.

@iansu
Copy link
Contributor

iansu commented Apr 19, 2019

This is not something we're doing in our webpack config. These are the default names that webpack uses for chunks. I'm not sure that we can easily change them. You might want to file an issue with webpack and then link to it here.

@march08
Copy link
Author

march08 commented Apr 29, 2019

This is not something we're doing in our webpack config. These are the default names that webpack uses for chunks. I'm not sure that we can easily change them. You might want to file an issue with webpack and then link to it here.

I've attached links to files where the problem is in the webpack configuration

javadoug added a commit to javadoug/create-react-app that referenced this issue Sep 13, 2019
@javadoug
Copy link
Contributor

My company has a firewall rule that rejects any url with ~ in it. I need this fix (would not want to eject) for this issue.

Per Webpack #runtimeChunk documentation the config change is easily done as noted by op.

PR provided #7679

If this fix is already provided elsewhere I will gladly close.

javadoug added a commit to javadoug/create-react-app that referenced this issue Sep 13, 2019
@ianschmitz ianschmitz removed this from the 3.x milestone Sep 13, 2019
@lock lock bot locked and limited conversation to collaborators Sep 19, 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.

8 participants