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

[Question] Get exported file ? #2532

Closed
remy-poirier opened this issue Jun 14, 2017 · 2 comments
Closed

[Question] Get exported file ? #2532

remy-poirier opened this issue Jun 14, 2017 · 2 comments

Comments

@remy-poirier
Copy link

remy-poirier commented Jun 14, 2017

Hello,

I would like to know if what I want to do is possible.

I want to use some backend framework to store informations in Database.
And I would like to avoid make an API knowing that I will be the only one accessing this database.

So I tried to integrate create-react-app in my the project folder, it works well in development, I just had to add a CORS header filter in order to allow localhost:3000 (npm) to make request on localhost:9000 (Backend). And it works pretty well on development.

However, what I would ideally do, is to do npm run build get the JS file outputted, and insert this JS in my HTML file rather thank keeping the basic HTML ?

Can I do that ?

@viankakrisna
Copy link
Contributor

viankakrisna commented Jun 14, 2017

yes, you can do that with asset-manifest.json that is generated in build folder during npm run build

quick example using php:

$assets = file_get_contents(__DIR__.'build/asset-manifest.json');
?><script src="<?php echo $assets['main.js']; ?>"></script><?php

@gaearon
Copy link
Contributor

gaearon commented Jun 22, 2017

That's right.

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

No branches or pull requests

3 participants