Questions tagged [webpack-plugin]

A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows to load parts for the application on demand. Through "loaders" modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.

132 questions
0
votes
0 answers

Electron Forge webpack plugin - not seeing node modules

I have been using the electron-forge webpack plugin to create a packaged bundle. My main process uses node modules. I have followed the webpack plugin documentation and have set up webpack.main.config and webpack.renderer.config according to the…
0
votes
0 answers

Compile Array/Object to a JSON file in Webpack

The Issue Consider the following JS file: ./src/test.js import { Something } from 'some-package'; import SomeImage from 'static/assets/images/some-image.png'; export const test = [ { foo: 'bar', messages: [ 'Hello World' ], …
Ben Carey
  • 16,540
  • 19
  • 87
  • 169
0
votes
0 answers

Trigger one of the webpack plugins on file change

is this possible to run one of the plugins from webpack.config.js on HMS reload? I'm using MergeIntoSingleFilePlugin to combine a few files into one. I'd love to trigger this plugin when one of the files that ought to be bundled will change. Is this…
0
votes
1 answer

How to recognize a compilation is first-time-build or refresh in wepack compile hook 'done'?

I want to collect the build speeds of our project for advancing performance optimization. The indexes include build-speed, devServer-start-speed, and devServer-refresh-speed: build-speed: the speed when run webpack build in…
0
votes
1 answer

How does NextJS detects & fetches a new page?

In a fresh NextJS project, I start the dev server by running yarn dev and add the following code to the pages/index.jsx: export default Home(){ return Go to abc } Suppose I create a new page in the pages directory called…
Shyam Swaroop
  • 793
  • 10
  • 7
0
votes
0 answers

Creating files during Webpack build but referencing them in development and in built

I'm not a Webpack expert, so this might be the wrong way to look at the problem, but that's what I want to find out: I'm developing a package/Webpack plugin that creates some JSON files that can be referenced in the application. Think the…
Parsa Safavi
  • 218
  • 2
  • 10
0
votes
1 answer

How to get contenthash of emitted assets in webpack plugin?

Sometimes, for some reason, webpack emits assets with identical content. In the plugin I'm writing now, I need to make sure that the asset content has changed. I'm using compiler.hooks.done hook and stats.compilation.emittedAssets argument to…
Levap
  • 67
  • 4
0
votes
1 answer

How to add favicon in react application?

I want to add favicon in my react application. I saw this post and followed but it is not working in my case. I added favicon.ico inside public folder where index.html is present. This is my directory structure This is the snippet of my…
0
votes
1 answer

Can I use other plugins in my plugin in webpack 4?

I have a working webpack configuration. Now I want to make a single plugin. I tried this suggestion but no success. Using a loader inside a webpack plugin
Varuzhan
  • 43
  • 7
0
votes
1 answer

Trouble with HarmonyImportSpecifierDependency

I am writing plugin, which inlines some code. And I have troubles with internal webpack plugin Intro My aim is to transpile this code // a.js export const getFoo = x => x.foo; // b.js import {getFoo} from './a.js'; export const func = x =>…
re-gor
  • 1,311
  • 11
  • 17
0
votes
0 answers

How to write a webpack plugin to replace require function to its source code

Say we have a util.js contains functions a and b: // util.js export function a() { ... } export function b() { ... } And I require them in index.js: // index.js export default function main() { const {a, b} = require('./util'); ... …
bambooom
  • 664
  • 6
  • 15
0
votes
0 answers

Webpack 5 File Shadowing loader

We are currently using a file shadowing mechanism similar to the gatsby file shadowing: https://www.gatsbyjs.com/docs/conceptual/how-shadowing-works/ With this solution we were able to have one next.js repository and build for different clients and…
0
votes
1 answer

Cannot read property 'tapPromise' of undefined when build using css-minimizer-webpack-plugin

webpack.common.js optimization: { minimize: true, minimizer: [ new CssMinimizerPlugin({ test: /\.foo\.css$/i, //or already used test: /\.css(\?.*)?$/i }), ], }, any suggestion what the problem is?
0
votes
1 answer

How to create a External Plugin in webpack5?

I tried to create an external plugin that can ask webpack not bundle things. Because threads-plugin don't accept external setting of webpack, it can only use plugin to external things. I tried my best to make this: const ModuleFilenameHelpers =…
林东吴
  • 171
  • 1
  • 8
0
votes
1 answer

Webpack plugin v5 existsAt doesn't exist in compilation object

I'm upgrading a webpack plugin from v4 to v5. Part of my plugin used to read the compilation.assets object to figure out the generated asset's absolute path to do some calculation. But each asset in v5 now only contains the SizeOnlySource object,…
Brianzchen
  • 1,265
  • 5
  • 21
1 2 3
8 9