Skip to content

[Question] Get exported file ? #2532

Closed
Closed

Description

@remy-poirier

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 ?

Activity

  1. viankakrisna commented on Jun 14, 2017

    @viankakrisna
    Contributor

    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
    
  2. gaearon commented on Jun 22, 2017

    @gaearon
    Contributor

    That's right.

  3. locked and limited conversation to collaborators on Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions