Skip to main content

Questions tagged [webpack]

Webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it can also transform, bundle, or package just about any resource or asset. Webpack takes modules with dependencies and generates static assets representing those modules. Webpack enables extensibility and promotes best practices in web architecture and performance.

webpack
19,907 questions with no upvoted or accepted answers
37 votes
2 answers
7k views

Slow sass-loader Build Times with Webpack

Summary When we switched to using Webpack for handling our SASS files, we noticed that our build times in some cases became really slow. After measuring the performance of different parts of the ...
mc92's user avatar
  • 485
33 votes
2 answers
5k views

Unable to import webpack-bundled UMD library as an ES6 import

I've authored a javascript library using Webpack. The entrypoint someClass.js looks like this: import x from './x' /* several more imports here */ class SomeClass {} export default SomeClass; My ...
StillFiles2's user avatar
25 votes
1 answer
1k views

Why does Webpack output weird comments before each line?

What's with the leading /******/ comments WebPack generates in output? Is it to mark WebPack related code, or is there more to it? Here's a simple output example: /******/ (function(modules) { // ...
josef.van.niekerk's user avatar
22 votes
1 answer
2k views

How to split chunks when authoring libraries with webpack 4?

I'm trying to publish a custom react component to a private repository. I use react-loadable to load a subcomponent on demand. When running locally, everything works fine. The index.js file ...
atopcu's user avatar
  • 232
22 votes
1 answer
631 views

Webpack shows warning twice

I have an ejected CRA and I recently upgraded Webpack to version 5, and now after using npm run start I get warning twice (attached), is there any option to show it only once? I noticed that on new ...
GuyML's user avatar
  • 297
20 votes
2 answers
3k views

Inject CSS Modules to Per-Component Style Elements (for portability to shadow root)

TL:DR How can I get CSS of React components to work inside of a shadow root, while keeping the encapsulation benefits of CSS Modules class? I'd like to insert per-component <style> elements ...
mike-shtil's user avatar
20 votes
2 answers
3k views

Webpack: Different (Define Plugin) settings per entry point

For some of my bundle files I would like to build different versions (for example one with admin functionality and one without). It seems the DefinePlugin is usually used for this kind of thing, but ...
AndreKR's user avatar
  • 33.4k
19 votes
1 answer
2k views

webpack plugin that adds other plugins

I'm trying to create a plugin that acts as a plugin wrapper, loading configuration, files, etc. and adding more plugins to the current webpack compilation process. In the apply function I create the ...
danikaze's user avatar
  • 1,614
19 votes
1 answer
2k views

Update only the chunks that have changed with Webpack.watch()?

I have a webpack build that utilizes the watch() method to continuously rebuild my javascript as I work. I also have a watcher that uploads changed JS files to a remote server. Right now when I ...
lostPixels's user avatar
  • 1,313
19 votes
2 answers
5k views

Using webpack with a .html entry

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 ...
P Varga's user avatar
  • 19.9k
18 votes
1 answer
2k views

Use service workers with Webpack dev-server inside Docker container

I'm trying to use service workers inside a web app using Webpack and Docker. Everything I made for the moment is working well (service worker, webpack config, worker registration...) Actually my app ...
Jérôme's user avatar
  • 2,036
17 votes
0 answers
2k views

Next.js SSG Image Optimization at Build Time

Problem I am trying to use image optimization for local files inside the public directory in a SSG Next.js project. There have been quite a few discussions on Github about introducing the possibility ...
TSTobias's user avatar
  • 243
17 votes
1 answer
1k views

What is the purpose for the fallback option in ExtractTextPlugin.extract

Using the example from webpack-contrib/extract-text-webpack-plugin: const ExtractTextPlugin = require('extract-text-webpack-plugin'); module.exports = { module: { rules: [ { test:...
Kocur4d's user avatar
  • 6,821
17 votes
0 answers
2k views

Angular CLI Hot Module Reload

I followed this github story: https://github.com/angular/angular-cli/wiki/stories-configure-hmr I am able to see changes after auto-refresh when I do ng serve (environment is Dev), however with ng ...
Moshe's user avatar
  • 2,664
17 votes
3 answers
2k views

Angular Multiple Entry Points with AOT

I have an angular app that is compiled with webpack and uses multiple entry points: entry: { 'app1': helpers.root('src', 'app1', 'main.ts'), 'app2': helpers.root('src', 'app2', '...
sqwk's user avatar
  • 2,689

15 30 50 per page
1
2 3 4 5
1328