webpack-file-loader

All images in /assets folder dissapear when I build with webpack

你说的曾经没有我的故事 提交于 2021-02-19 05:30:32
问题 Until now I worked in dev enviroment , but now I arrived into prod enviroment , and I run into this issue: some important details on the project: Everything works fine when I run the project on webpack-dev-server Its a React app I costumized webpack.config myself so maybe I have some mistakes (not a create-react-app) My /assets folder has some images I have font-awesome installed I use file-loader to deal with font-awesome and all the images The problem: After I run build I loose all of the

All images in /assets folder dissapear when I build with webpack

这一生的挚爱 提交于 2021-02-19 05:30:32
问题 Until now I worked in dev enviroment , but now I arrived into prod enviroment , and I run into this issue: some important details on the project: Everything works fine when I run the project on webpack-dev-server Its a React app I costumized webpack.config myself so maybe I have some mistakes (not a create-react-app) My /assets folder has some images I have font-awesome installed I use file-loader to deal with font-awesome and all the images The problem: After I run build I loose all of the

push assets folder to public directory with webpack

删除回忆录丶 提交于 2021-02-18 04:56:31
问题 I'm using Webpack for the first time. Currently everything is being served up quite nicely. My problem is when I'm trying to build a dist folder. Currently I get my index.html and bundle.js files but I can't figure out how to push my assets to the dist folder. I have file-loader loaded up but it doesn't actually seem to do what I want it to and none of the google searches I've run are telling me what I need to know. Below is my config file. Can someone lead a horse to water? Also once I get

Html-loader + file-loader not bundling the correct image source

廉价感情. 提交于 2021-02-11 15:12:59
问题 I'm planning to use Webpack for a project and I'm setting up my workflow with Html-loader + file-loader to get a production html file with dynamic src for the images, as Colt Steele teaches in this video. Here are my src/ files: index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Popular on Letterboxd</title> </head> <body> <img src="./assets/chira.jpg" /> </body> </html> index.js: import img from './assets/chira.jpg'; import "./main.css"; And main.css body {

Html-loader + file-loader not bundling the correct image source

核能气质少年 提交于 2021-02-11 15:11:58
问题 I'm planning to use Webpack for a project and I'm setting up my workflow with Html-loader + file-loader to get a production html file with dynamic src for the images, as Colt Steele teaches in this video. Here are my src/ files: index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Popular on Letterboxd</title> </head> <body> <img src="./assets/chira.jpg" /> </body> </html> index.js: import img from './assets/chira.jpg'; import "./main.css"; And main.css body {

Webpack - Include file multiple times

旧巷老猫 提交于 2021-02-10 06:38:50
问题 I want to include a file twice through two different loaders. The reasoning is I want to display code snippets in ES6 while allowing them to be run in browsers not supporting the syntax. Effectively what I would like to achieve is the below but with both loaders results being included in the output - { test: /\.(js|jsx)$/, exclude: /node_modules/, loader: "babel-loader" }, { test: /\.(js|jsx)$/, include: /app\/examples/, use: [ { loader: "file-loader", options: { regExp: /app\/examples\/([^\/

Using webpack with a .html entry

不问归期 提交于 2020-12-29 09:34:22
问题 How can I webpack a web app into an output .html file, starting from a traditional input .html ? Here is a simple starting point: index.html <body> <output></output> <script src="./main.js"></script> </body> main.js import React from "react"; document.querySelector("output").innerText = React.version; webpack.config.js module.exports = { entry: "./index.html", output: { filename: "output.html" }, module: { rules: [ {test: /^index\.html$/, use: [ {loader: "extract-loader"}, {loader: "html

Serving mp3 files using the webpack file loader

走远了吗. 提交于 2020-04-29 08:02:53
问题 I have a problem with getting my mp3 files to work using the webpack file loader. This is the issue: I have a mp3 file on my harddisk, that if I open using chrome by for example "c:\somefolder\somemp3file.mp3" opens up in a tab in the browser and plays just fine. However, when I serve the exact same file using webpack it does not work. I have configured the loader in webpack like this: { test: /\.(gif|jpg|png|mp3|aac|ogg)$/, loader: 'file' } Then, when I'm trying to link to the file I require