Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

191
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!