Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #1438
Closed
Open
Issue created Jan 24, 2017 by Administrator@rootContributor

Environment variable not accessible in public/index.html

Created by: jnachtigall

My public/index.html seems to have access to PUBLIC_URL but not to any other environment variable.

$ cat .env
REACT_APP_ASSETS_URL=abc

still when referring the var REACT_APP_ASSETS_URL is not resolved in public/index.html:

npm start results in URIError: Failed to decode param '/%REACT_APP_ASSETS_URL%/main.min.js' and the html still has the var string unresolved whereas the js code can access the var with <strong>{process.env.REACT_APP_ASSETS_URL}</strong>

I think not only the PUBLIC_URL var should be accessible in the html, but all vars.

Background: My react app is included in a page that already has some header and footer which comes with external js and css. I copied the header and footer html to the public/index.html, but like to retrieve the legacy css and js from an external server.

Assignee
Assign to
Time tracking