Questions tagged [html-webpack-plugin]

webpack plugin to simplify creation of HTML files to serve webpack bundles

A plugin for to simplify creation of HTML files to serve webpack bundles

452 questions
40
votes
5 answers

How to load images through webpack when using HTMLWebpackPlugin?

I am using HTMLWebpackPlugin and in my template I have an img tag: If you notice, here I am using a relative path thinking webpack will trigger the file loader that's configured in my webpack.config.js file but after…
Anonymous
  • 1,658
  • 2
  • 14
  • 19
37
votes
8 answers

Webpack, html-webpack-plugin, Error: Child compilation failed

I 've got a problem with my webpack configuration. After implementing html-webpack-plugin I got an Error, there's whole error stack from generated index.html. Error Stack: Html Webpack Plugin: Error: Child compilation failed: Conflict: Multiple…
Jakub Chlebowicz
  • 509
  • 1
  • 6
  • 12
33
votes
5 answers

Entrypoint undefined = index.html using HtmlWebpackPlugin

I'm using Webpack 4 and I'm creating the config file, when trying to use the HtmlWebpackPlugin it got this on the console: Entrypoint undefined = index.html, it opens the browser and the HTML does appear but I'm getting this weird message on the…
xahovuzu
  • 351
  • 1
  • 4
  • 4
30
votes
2 answers

How to use Webpack 4 SplitChunksPlugin with HtmlWebpackPlugin for Multiple Page Application?

I'm trying to utilize the SplitChunksPlugin to produce separate bundles per each page/template in a MPA. When I use the HtmlWebpackPlugin, I get an html file for each page with a script tag pointing to the correct bundle. That is great! However, the…
Dave
  • 645
  • 8
  • 16
29
votes
8 answers

How do I add certain script tags inside and tags when using HtmlWebackPlugin

I'm using HtmlWebpackPlugin to generate HTML files with javascript. Now I would like to add custom script at different parts of and tags Example: How do I, Add inside the tag as the first…
Greeen Apple
  • 441
  • 1
  • 4
  • 12
24
votes
2 answers

How does html-webpack-plugin work with html-loader?

I thought a loader is invoked only when some resource is imported or required somewhere and the resources match with such a loader. But in the following codes, no html file is imported anywhere but the html-loader is still necessary to make the…
Shawn Chen
  • 1,017
  • 2
  • 13
  • 24
24
votes
8 answers

Webpack html-webpack-plugin load favicons in template

I'm using Webpack with html-webpack-plugin and their provided template. I want to add a list of favicons in the header:
denislexic
  • 10,786
  • 23
  • 84
  • 128
19
votes
6 answers

Error: Cannot find module 'html-webpack-plugin' - Webpack (React)

I tried to create a basic React app with webpack 4 following this link until installing "html-webpack-plugin", I did not face any errors. But, once I run the command "npm run start", I keep getting the following error: **Error: Cannot find module…
user8449046
  • 191
  • 1
  • 1
  • 3
19
votes
1 answer

How to use Webpack with Google Maps API?

I am using Webpack + html-webpack-plugin to build all my static files. The thing is, when I am using it with Google Maps API, it's not working. I have this code: var map; function initMap() { map = new…
serge1peshcoff
  • 4,342
  • 11
  • 45
  • 76
18
votes
0 answers

webpack plugin that adds other plugins

I'm trying to create a plugin that acts as a plugin wrapper, loading configuration, files, etc. and adding more plugins to the current webpack compilation process. In the apply function I create the plugins and then apply them against the original…
danikaze
  • 1,550
  • 2
  • 16
  • 34
18
votes
1 answer

How do I integrate the value of __webpack_nonce___ with my Content Security Policy?

From my understanding of Content Security Policy, the nonce has to change on every request. That means (I think) it must be generated at run-time on the client, not at build-time in the Webpack config. I've tested the webpack_nonce functionality in…
Paul Z
  • 301
  • 1
  • 2
  • 4
18
votes
3 answers

Webpack html plugin is not generating html

I am using webpack html plugin to generate the html page from the graphiql.ejs but it is not generating html page when I am running npm start webpack.config.js var HtmlWebpackPlugin = require("html-webpack-plugin"); module.exports = { plugins: [ …
N Sharma
  • 33,489
  • 95
  • 256
  • 444
17
votes
1 answer

How to use chunksSortMode in HtmlWebpackPlugin / webpack 2

I have an issue with the order of my chunks inserted in index.html. I'm using webpack2 and HtmlWebpackPlugin. I think what is controlling the order of the chunk is the chunksSortMode option. The documentation for HtmlWebpackPlugin is…
Tonio
  • 4,082
  • 4
  • 35
  • 60
16
votes
2 answers

htmlWebpackPlugin add only one entry point to the generated html

Below are the webpack config entries : entry:{ background: './app/main/background.js', options: './app/main/options.js' } One HTML page which is suplied to htmlwebpackplugin as below new HtmlWebpackPlugin({ template…
Irshad
  • 1,016
  • 11
  • 30
16
votes
5 answers

Inline JavaScript and CSS with webpack

I'm using Webpack for bundling resources. Currently it bundle both the CSS and JS files into a separate file called bundle.js. How can I make both the JS and CSS embedded inline in html file? import HtmlWebpackPlugin from…
VJAI
  • 32,167
  • 23
  • 102
  • 164
1
2 3
30 31