Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

197
Vistas
How to load a local html file inside an iframe in my react application?

I'm having troubles when trying to load a html file from my public folder in a React application created with create-react-app. Am I missing a config setting somewhere in webpack?

I currently have this folder structure:

enter image description here

And I want to show the test.html file inside an Iframe in my React component like this:

import React from 'react';

const Component = props => {
  return (<iframe src="/test/index.html"title="Docuvieware" />);
};

export default Component;

But this is giving me a "Cannot GET /test/index.html" in the Iframe. Also when surfing directly to http://localhost:3000/test/index.html I get a white page that says 'Cannot GET /test/index.html'

I also tried to use "process.env.PUBLIC_URL" inside my component but this was undefined.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I have managed to fix this by using CopyWebpackPlugin. Just added the test folder in my src folder, and then added the following line to my webpack config:

new CopyWebpackPlugin([{ from: 'src/test', to: 'test' }]),

and then /test/index.html gave the correct path.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda