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

Add public folder after eject from 0.2.2 #938

Closed
kdichev opened this issue Oct 21, 2016 · 6 comments
Closed

Add public folder after eject from 0.2.2 #938

kdichev opened this issue Oct 21, 2016 · 6 comments

Comments

@kdichev
Copy link

kdichev commented Oct 21, 2016

Hey guys,

I have started a project a couple of months ago (react-scripts 0.2.2) and now because I will be deploying to production and our partners are very skeptical about cdn's I am using. I want to create a public folder.

Can you guys give me a hint how to add that one?

I checking the new version of create-react-app and ejecting and checking the code differences.

@gaearon
Copy link
Contributor

gaearon commented Oct 21, 2016

You can revert the commit when you ejected, then apply migration instructions in the changelog from the old version to the one you need, and then optionally eject again.

@kdichev
Copy link
Author

kdichev commented Oct 21, 2016

Thanks for the tip. I will try and revert commit even tho we did a lot of changes to build to also deploy for us.

ps. and offtopic: Gaearon thanks for all your work and efforts to help the community I have personally learned a lot from you!!!

@gaearon
Copy link
Contributor

gaearon commented Oct 21, 2016

If it's too hard to reapply changes, you can try following what was done in #703.
Thanks!

@kdichev
Copy link
Author

kdichev commented Oct 22, 2016

I have actually did manage to do it after checking the new build file.

Added appPublic and AppBuildPublic to paths.js

appPublic: resolveApp('public'),
appBuildPublic: resolveApp('build/public')

Added var fs = require('fs-extra'); // npm install fs.extra --save in build.js
Added copyPublicFolder in build.js and append the function at the end of the recursive function in build.js and referenced the correct build path for public folder in copyPublicFolder funtion:

function copyPublicFolder() {
fs.copySync(paths.appPublic, paths.appBuildPublic, {
dereference: true,
filter: file => file !== paths.appHtml
});
}

Is this a proper quick solution @gaearon ?

welcomed with any suggestions.

@kdichev kdichev changed the title Add public folder after eject Add public folder after eject from 0.2.2 Oct 22, 2016
@gaearon
Copy link
Contributor

gaearon commented Oct 22, 2016

For this to work in development, you'd also want to include the public folder into WebpackDevServer option called contentBase in scripts/start.js.

@gaearon
Copy link
Contributor

gaearon commented Oct 22, 2016

(I'll close as this isn't an actionable issue for us.)

@gaearon gaearon closed this as completed Oct 22, 2016
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants