Questions tagged [webpack-loader]

141 questions
3
votes
1 answer

Configure Webpack to look for files matching directory name

I'm setting up an environment for a React app. I'm using Babel and Webpack. Currently, all of my components are implemented in files following this naming scheme: /components /Component1 Component1.js …
Gregor Menih
  • 5,036
  • 14
  • 44
  • 66
2
votes
1 answer

Migrating angular project from 13 to 14 get Module parse failed: Identifier 'UntypedFormBuilder' has already been declared

I have tried this: Migrate angular project 13 to 14 Add new component into existing module After that I have change formBuilder to UntypedFormBuilder then I get this error while build or serve project below is the screen shot and the code…
2
votes
1 answer

How to import pre-processed CSS as string with Webpack?

I need to import the compiled CSS code as string from ".styl" (Stylus pre-processor) files. From the viewpoint of logic: First we need to pre-process the styles. It's exprected that stylus-loader will do it with stylus pre-precessor. Next we need…
Takeshi Tokugawa YD
  • 670
  • 5
  • 40
  • 124
2
votes
1 answer

Webpack loaders in require.context on a Typescript create-react-app

I have far too many svg icons to import them all in the recommended way: import { ReactComponent as Icon } from 'assets/svg/icon.svg' So in my JS React apps I've been using webpack's require.context to index the entire svg directory and export it as…
Summer
  • 1,175
  • 8
  • 18
2
votes
2 answers

Autodesk React Forge problem with forge-dataviz-iot-react-components in a empty project

If you install the official npm package, it works. But according to the official documentation and simply including import { Viewer } from "forge-dataviz-iot-react-components" (like in this example) in a empty new react project (using npx…
Francesco Orsi
  • 1,739
  • 4
  • 16
  • 32
2
votes
3 answers

Can't import CSS from Swiper using Webpack with error "Module parse failed: Unexpected character '@' You may need an appropriate loader"

I have a project using SCSS. In this project a minified CSS file is generated during compilation. Now I wanted to add Swiper to the project. So I tried to import the correspodning styles before my styles in index.js. Unfortunately I get an error…
lampshade
  • 2,470
  • 3
  • 36
  • 74
2
votes
1 answer

Vue 3 include local static files into index.html

<%= htmlWebpackPlugin.options.title %>
Most Wanted
  • 6,254
  • 5
  • 53
  • 70
2
votes
0 answers

Using a custom webpack loader in Nuxt

I am using Nuxt.js, and I want to tell Webpack to use a specific loader (raw-loader) for a specific file extension (.pug). According to the documentation, I should add custom webpack rules using build.extend, i.e. something like this: build: { //…
leo
  • 8,106
  • 7
  • 48
  • 80
2
votes
1 answer

Can't load a module with custom loader in vue-cli project

I have a project where Webpack 4.43.0 is set up with vue-cli. I'm trying to use image-size-loader to get image size at build time. For that, in one of my .vue files I'm trying to load the module using the custom loader I have installed in the…
gvlasov
  • 18,638
  • 21
  • 74
  • 110
2
votes
1 answer

Angular ignores file-loader in AOT build

I'm currently trying to build a documentation website in Angular. Docs will be written in markdown and displayed through the ngx-markdown plugin. Everything works fine on a JIT build, but an AOT build always removes the markdown files. This is how I…
Marlex
  • 43
  • 1
  • 5
2
votes
1 answer

Webpack: Need an appropriate loader to handle this file type error

I'm new to webpack and I'm trying to install Webpack Bundle Analyzer on my project and I'm getting this error. I'm following this guide:…
TechnoCorner
  • 4,879
  • 10
  • 43
  • 81
2
votes
1 answer

External React component library JSX Babel wont compile

I'm trying to extract certain compoennts in my React Application to a separate reusable component library. What I've done, is cloned this project: https://rinsejs.io/ and subsequently referenced the github repo in my main projects package.json entry…
Squiggs.
  • 4,299
  • 6
  • 49
  • 89
2
votes
1 answer

How can I evaluate a Node script during a Webpack build and make it contents available to the compiled code?

I have a Node script that uses fs.readFileSync several times to read various JSON5 configuration files that exist on the filesystem. These are read in, combined, manipulated, appended to, etc. based on certain criteria in the ENV variables. The…
Michael Irigoyen
  • 22,513
  • 17
  • 89
  • 131
2
votes
1 answer

Using a custom webpack loader to attach extra fields onto default export

I'm attempting to write a custom webpack loader that loads demo javascript files together with their source for documentation purposes. It should Load the indicated javascript file (e.g. Simple.demo.js) Attach the raw source of the file to the…
Duncan Thacker
  • 5,073
  • 1
  • 10
  • 20
2
votes
1 answer

Webpack 4: Creating loaders as functions (with the ability to send options)

I may be missing something obvious, but I can't seem to be able to create a Webpack 4 loader as a simple function that can take options: rules: [{ test: /\.csv$/, loader: function() { // ... }, options: { // ... } }] I dare not…
Dan
  • 9,912
  • 18
  • 49
  • 70
1 2
3
9 10