Questions tagged [webpack-loader]
141 questions
1
vote
1 answer
Create an Electron nativeImage from an ES6 imported file?
We're trying to improve our build system to rely less on relative path imports, and one area we need to work on this for is image loading. So we're trying to do something like this, loading the images in with Electron's nativeImage:
import {…

Slbox
- 10,957
- 15
- 54
- 106
1
vote
1 answer
Path created for background image is wrong in the template using webpack 5
I am trying to build my template files using webpack 5. The issue is the path of the background image that is being generated is "basic-project/dist/stylesheet/img/webpack-bg.png", instead it should be "basic-project/dist/img/webpack-bg.png".…

Sachindra
- 6,421
- 6
- 29
- 38
1
vote
1 answer
Fix TypeScript warning about imports handled by Webpack loaders?
I'm setting up a new project using Svelte, Webpack, and TypeScript. It's based on this template, and running the scripts/setupTypeScript.js script after initial setup to switch to TypeScript.
When trying to import resources that are not TypeScript…

Don McCurdy
- 10,975
- 2
- 37
- 75
1
vote
1 answer
Webpack4 thread-loader bring little optimization for babel-loader. Is something wrong, or why?
As mentioned in Webpack docs and many information that introducing how to improve webpack build speed, thread-loader can obviously improve the build speed of babel-loader.
But when I try it in my project, it seems like that thread-loader does not…

lklucas
- 11
- 3
1
vote
1 answer
How to exclude test files from vue cli build(using vue.config.js)?
There is no importing test codes. But the build process includes testing node modules(chai, sinon, nise...).
I added codes below on vue.config.js to exclude test files from build. (vue-cli-service build)
chainWebpack: (config) => {
if…

Jae Woo Woo
- 901
- 1
- 8
- 19
1
vote
2 answers
How to implement SASS into react with raw webpack?
So I was trying to use Bulma and got a can't import _varibales.sass, which I have in my src folder. So I thought it was because I didn't configure webpack to support Sass.
So I followed the configuration instructions from this tutorial, but then I…

Beulah Akindele
- 643
- 5
- 21
1
vote
0 answers
Webpack Loader: How to emit a single file after loader has run for every file?
Working on a Webpack loader that needs to transform source for each file and also emit a single file based on data from all those files. Looking at the webpack docs I wasn't quite sure if a loader can / should handle something like this or if a…

redwoodfavorite
- 21
- 4
1
vote
1 answer
script-loader alternative for webpack?
When bundling web app using webpack, i need to register some 3rd party scripts into global(i.e. window) namespace, script-loader seems designed for this Webpack - How to load non module scripts into global scope | window.
However, there is a big…

Allen
- 4,431
- 2
- 27
- 39
1
vote
1 answer
what is the different between webpack loader and babel-plugin?
In my opinion, webpack-loader has the same function as babel-plugin!!
So can you help me answer the difference between the two, isn't it all through the AST to manipulate the code?

Cart
- 11
- 2
1
vote
1 answer
How to read local html file content inside React js App using Webpack loaders?
I am working on react js app and trying to read html file content locally. On specific condition I am passing file html data inside a variable like this::
let content = require(`../Designs/${data.path}.html`);
But it gives me error:
Module parse…

Archana Sharma
- 1,953
- 6
- 33
- 65
1
vote
1 answer
How does css loader resolve resources in webpack
I was learning about css-loader in webpack, the defination says that
The css-loader interprets @import and url() like import/require()and will resolve them. What does it mean, In an example in the documentaion there is
url(image.png) =>…

user8989
- 580
- 2
- 6
- 21
1
vote
1 answer
Webpack loader error: You may need an additional loader to handle the result of these loaders
Once add react-hot-loader to Webpack config, the following error will arise.
Module parse failed: Unexpected character '@' (22:0)
File was processed with these loaders:
*…

licaomeng
- 919
- 2
- 13
- 27
1
vote
0 answers
Conditionally use loader in each watch build individually
I have a webpack loader in my configuration which I want to run only
in Watch Mode
Starting with the second run (or any other condition that might change with each individual watch build triggered by file changes)
What I already…

Sebastian Barth
- 4,079
- 7
- 40
- 59
1
vote
1 answer
Webpack module rule test: Match files that contain a specific parameter
I want to display some specific images as data-uri instead of linking to the image location. For that I'm using the url-loader.
Here's my HTML (pug template):
img.loading(:src="require('@/images/spinner.png?inline')")
And my webpack related…

Cornwell
- 3,304
- 7
- 51
- 84
1
vote
1 answer
Webpack: Custom loader - reuse file extension
I'm working on writing a loader for filename.xyz.json files.
Now since Webpack version 2, Webpack support loading JSON files out of the box.
So I've managed to get my loader to work when working when using a completely custom file extension like…

josias
- 1,326
- 1
- 12
- 39