Questions tagged [webpack-loader]
141 questions
2
votes
1 answer
Prevent Webpack's default loaders from running
Webpack has a JSON loader built into it. How can I write a custom loader that doesn't try to run the built-in JSON loader on the result?
Basically, I want my loader to take in a config object (stored in a JSON file) and generate source code from…

M Miller
- 5,364
- 9
- 43
- 65
2
votes
1 answer
Webpack: emit virtual module inside a Plugin
I'm writing a webpack Plugin and Loader and I'd like to create a "dynamic" module that's generated through my Plugin.
Basically, I want my loader emit an import to the dynamic module, like this:
module.exports = function (content) {
return `
…

Endel Dreyer
- 1,644
- 18
- 27
2
votes
0 answers
Webpack follow import path to avoid the need of tree shaking
I have some issues with tree shaking in my webpack 3 configuration (maybe) because I use a lot of re-exports.
I'd like to keep the reexports but avoid the unnecessary increase in my bundle size. (Plus I'd also like to avoid unnecessary code in my…

Krxldfx
- 709
- 1
- 10
- 23
2
votes
1 answer
chaining imports-loader and exports-loader with a library that overwrites the module variable
I'm trying to load an audio encoding library called libvorbis.js which is an emscripten compiled version of vorbis.
libvorbis.js requires to be executed with the window variable in it's scope and leaves the classes exposed as a var without an…

JasonY
- 752
- 10
- 24
2
votes
0 answers
srcset-loader creating broken files (webpack)
I am trying to use srcset-loader for creating srcSet and different size images for a project. The srcset-loader is working fine and outputs the following:
{
"sources": {
"100w":…

Tirth Bodawala
- 21
- 3
1
vote
1 answer
Webpack Failed to compile: loader issues with optional chaining
Created a react application with create-react-app along with typescript as the template.
Trying to use optional chaining:
const inputRef = useRef(null);
const handleClick = () => {
if(inputRef) {
…

Filth
- 3,116
- 14
- 51
- 79
1
vote
0 answers
Using Webpack's Node API, how can I run Webpack on a different directory while using loaders from the CWD?
I need to run Webpack on some arbitrary directory. That directory contains only some TypeScript source code, but not the loaders used in my Webpack configuration. So I have this:
webpack({
context: "/some/arbitrary/directory",
..., // Some…

HelloWorld
- 3,381
- 5
- 32
- 58
1
vote
0 answers
Vuejs - custom loader to manipulate SFC template block
I'd like to manipulate Vue SFCs 'template' blocks during Webpack compilation.
The goal
Being able to (mainly) remove some parts based on env varibale, sort of a conditional compilation.
This would lead to a (slightly) longer compilation but to…

fudo
- 2,254
- 4
- 22
- 44
1
vote
1 answer
Can Webpack plugin transform a file like loader?
I know that loaders are used to transform the module.
But let's say I have a file that require a special process that can not be done by using loader. Can I develop a plugin to do that?
I know Plugin can do many thing including adding new assets.…

Thelearning
- 135
- 1
- 8
1
vote
0 answers
Django webpack_loader: `Regex` Undefined?
I've updated a Django app to Python 3.9 and Django 4.0, and I'm getting an error on launch:
TypeError: expected string or bytes-like object
I tracked it down to this function in python3.9/site-packages/webpack_loader/loader.py:
def…

VikR
- 4,818
- 8
- 51
- 96
1
vote
0 answers
How to correctly load .pcss - postcss files with webpack?
I'm trying, without success so far, to load postcss , .pcss files with webpack
Packages installed :
"postcss": "^8.4.13",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-loader": "^6.2.1",
"extract-text-webpack-plugin": "^3.0.2"
"webpack":…

Raphael10
- 2,508
- 7
- 22
- 50
1
vote
2 answers
Can't parse .mjs module from Iconify. Vue 3 cli using composition api and typescript
Update:
Changing: if(data.aliases?.[name2] !== void 0)
to: if(data.aliases != null && data.aliases[name2] !== void 0)
in the iconify .mjs file fixes the error, however this check occurs a lot of places, and is not viable. Any idea why I cant parse…

GossipDolphin
- 351
- 1
- 2
- 9
1
vote
0 answers
How to ship a vue component with associated vuex and css with it so that i can use it in different project
Hi i have 2 projects one is core and another is plugins [both project have its own folder and package.js] my intention is plugin must work without compiling from core independently.
Project structure: only rendered view not folders
…

EaBengaluru
- 131
- 2
- 17
- 59
1
vote
0 answers
Resolve deprecation warning "DeprecationWarning: Compilation.cache was removed in favor of Compilation.getCache()"
I use the npm package service-worker-loader. I get this waring when building the project:
node:25260) [DEP_WEBPACK_COMPILATION_CACHE] DeprecationWarning: Compilation.cache was removed in favor of Compilation.getCache()
I have discovered through…

Elena Alexeenko
- 100
- 4
- 13
1
vote
0 answers
Use Webpack to transform and save image file
I am using React for a period of time and absolutely love the file watch functionality provided by webpack loaders.
I have written some simple loaders for my needs also, but now I have a bit complex task to solve.
Well, there are some binary files…

Epsiloncool
- 1,435
- 16
- 39