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

193
Vistas
Link a static JS file with HtmlWebpackPlugin

I am building an application with a custom webpack configuration.

I have integrated the HtmlWebpackPlugin with a custom index.html like so:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Text Mining</title>
    <link rel="icon" type="image/x-icon" href="favicon.ico" />
    <link rel="preconnect" href="https://fonts.gstatic.com" />
    <link
      href="https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700&display=swap"
      rel="stylesheet"
    />
  </head>
  <body>
    <div id="app"></div>
  </body>
</html>
      new HtmlWebpackPlugin({
        inject: true,
        filename: './index.html',
        template: './public/index.html',
        favicon: './public/favicon.ico',
        scripts: ['./public/static/js/env.js']
      }),

I assumed that adding the path to my static js file in the scripts array would copy env.js into the compiled html but I cannot see it.

Is there another plugin i need to copy from the public folder or am i missing something else?

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

0

I am not sure if this is a good solution, but I have recently used copy-webpack-plugin to solve a similar issue. Maybe this will help you.

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