Questions tagged [webpack-html-loader]

Important topic to understand is the difference between html-webpack-plugin and html-loader:

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

Html loader home page: https://github.com/webpack-contrib/html-loader

102 questions
0
votes
0 answers

karma-webpack-jasmine html-loader not working inside test

I'm using karma-(webpack|typescript|jasmine|coverage) which is working neatly. The only problem is, that html-loader imports are undefined inside my tests. In other words, the following test is passed successfully: // index.test.ts import template…
0
votes
0 answers

Webpack - Handle imports in uncommon file-types

in my use case i have integrated the conversion of asciidoc files (.adoc) using asciidoctor.js to html-files within custom loaders in my webpack build. Therefore my entry is an asciidoc file and my final output is an html-file. The issue that i am…
btreitz
  • 260
  • 2
  • 8
0
votes
0 answers

webpack 5 with html-loader and images src in html files not working

I am using webpack 5 with html-loader, I have a problem, images src in html files not working. first of all here is my project tree dist => index.html src => assets => images => logo.jfif Here is my webpack.config.js code const path =…
yasser Eltibili
  • 134
  • 2
  • 8
0
votes
1 answer

Error when I use html-loader in a web pack project

I am setting webpack but I have an error. It happens when I try to use html-loader, what I do when I set rules in the module in webpack.config.js file. It says there is an error in child compilation. I am trying to understand why. Here is the error…
Emilie Tossan
  • 127
  • 1
  • 1
  • 16
0
votes
1 answer

html-loader only works on index.html file

I'm working on a static site project, and have to now add multiple pages using the same header and footer. I'm trying to do this by turning the header.html and footer.html files into partials. I've setup my webpack.config.js to use HtmlWebpackPlugin…
jerome
  • 411
  • 2
  • 11
  • 23
0
votes
2 answers

Opening an external html file from a react app

I have a react app, which i make thought create-react-app. I want to make here a link, that will refer to project.html file. I tried to make something like this: const Portfolio = (props) => { return (
Gleb
  • 13
  • 3
0
votes
1 answer

saving SCSS change causes webpack fail to load image file from HTML img tag (Webpack 5)

I just get this problem recently , but I can't figure out what is wrong with my webpack setting. Every time I save my SCSS files (./src/scss/) change, and webpack do refresh the page (it is hot module reload I guess), but after the refresh, my image…
0
votes
1 answer

display image in html using webpack

when i use html-loader and file loader then in development mode image in not dispaly on browser images in src->assets->images folder and in html file please suggest me what i can do to run the code in both development and product mode …
0
votes
1 answer

Webpack 5 with html-loader gives ReferenceError

I'm trying to run a hello world app in Angular 12 + webpack 5. When I try to add html-loader (as all the guides say i should), I get the error below. Why does this happen? and how can I fix it? If you'd like to replicate the situation, please see…
Preston
  • 7,399
  • 8
  • 54
  • 84
0
votes
1 answer

How can I work with anchor tags in webpack?

I must be missing something because there seems to be almost no documentation about parsing anchor tags in webpack. For example if I want to hash the name of html files which are linked to in my landing index page. Just like this post says: Webpack…
0
votes
1 answer

How to use in React with Webpack?

I need to create an array of div (with the image inside). My code so far: let slides = sliderData.map(() => { let advantagesList = advantages.map((adv) => { return(
  • {adv.name}
  • ); }); return…
    0
    votes
    1 answer

    ReactJS link to local HTML file from different folder/project

    I'm using ReactJS to build a site, and I want to create a link (a href="relativepath") to a local HTML file so that when the user clicks on the link, it'll open up the html page. The local file is in a different folder X outside of the project, and…
    Phillip
    • 1
    • 1
    0
    votes
    1 answer

    Webpack doesn't rendering html partials in another html partial

    I'm trying to import static html components in my templates, I've this structure: /src/home.html.ejs /src/parts/header.html /src/parts/breadcrumbs.html /src/home.html.ejs body <%= require('./header.html')…
    Frunky
    • 385
    • 1
    • 6
    • 14
    0
    votes
    0 answers

    html-webpack-plugin@4.5.0 with html-loader@1.3.2

    I've configured webpack@5.10.0 (with webpack-cli@4.2.0) to work with html-webpack-plugin (plus file-loader@6.2.0 and sass-loader@10.1.0): const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const…
    rslemos
    • 2,454
    • 22
    • 32
    0
    votes
    1 answer

    React import html - Module parse failed: You may need an appropriate loader to handle this file type

    I want to import a html file and convert into json. const DocHtml = require('../../Shared/assests/index.html'); const template = { __html: DocHtml }; webpack.config.js module.exports = { module: { rules: [ { test: /\.html$/, …