Questions tagged [webpack-config]

42 questions
1
vote
1 answer

Webpack: configure path mapping

This is probably a trivial problem, but I am new to webpack. I have a project where the include paths seem to be messed up. The project structure looks like this (simplified): app/ ├─ webpack.config.js ├─ dist/ ├─ src/ │ ├─ main.js │ ├─ modules/ │…
Benni
  • 1,023
  • 11
  • 15
1
vote
0 answers

yarn install failed with Module parse failed: Unexpected character '@' (1:0)

I have the following configuration in my webpack.config.dev.js file const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); const path = require('path'); const webpackMerge = require('webpack-merge'); const MiniCssExtractPlugin…
1
vote
0 answers

How to update webpack plugins with breaking changes from v4 to v5?

From webpack's official migration tutorial: https://webpack.js.org/migrate/5/ Update outdated options Update the following options to their new version (if used): Does it mean that those plugins will no longer exist as actual plugins? What I…
cbdeveloper
  • 27,898
  • 37
  • 155
  • 336
1
vote
1 answer

Webpack for completely static project (no JS / TS at all)

My project is a JSON schema consisting of multiple JSON files: src ├── a.json ├── b.json └── c.json All I want to do is to replace a version placeholder in this files with a version from package.json. I.e. a.json contains a ${version} (actual…
madhead
  • 31,729
  • 16
  • 153
  • 201
1
vote
0 answers

ELIFECYCLE error with Webpack + React + Typescript

quite new to bundling modules using Webpack but trying it out. I have a very simple project that I'm trying to bundle up to display it. Running a build script gives me the mysterious error: $ npm run build > react-extension-from-scratch@1.0.0 build…
youssefrizk
  • 129
  • 3
1
vote
1 answer

Webpack: Node Modules Not Found

I have been working with webpack today, and all of a sudden it starts throwing me errors that it can't resolve common node modules like fs and inspect. I found this github issue that gives a workaround by setting the modules to none through…
1
vote
1 answer

Calling webpack.ignorePlugin (to tree-shake Moment.js locales) with CRA + rescripts

I am using CRA + with rescripts I want to tree-shake Moment.js locales, exactly the same way as shown in ignorePlugin Webpack docs: new webpack.IgnorePlugin({ checkResource (resource) { // do something with resource return true|false; …
1
vote
0 answers

Vue Cli Error: Rule can only have one resource source (provided resource and test + include + exclude)

Npm run serve is not working after I freshly installed npm in the project folder. I am using the latest webpack. Also tried uninstalling and installing npm gloabally. Though this was running before npm install. Nothing has changes in package.json…
Leena Nichare
  • 11
  • 1
  • 3
0
votes
1 answer

Webpack can't seem to load css

I am trying to create a npm package for a single .tsx component however When I run wepback I keep getting this error: ERROR in ./src/Chatbot.tsx 184:20 Module parse failed: Unexpected token (184:20) File was processed with these loaders: *…
0
votes
1 answer

Accessing mode from webpack config

I have in webpack.config.js: module.exports = { entry: { index: "./src/index.js", content: "./src/content.js" }, mode: "production", // How do I access this value from the React code? devtool:…
AlwaysLearning
  • 7,257
  • 4
  • 33
  • 68
0
votes
0 answers

When running yarn build, the Output file is not getting generated with Webpack 5 and throwing MIME type error in console using ReactJS application

I am working with upgrading Node.js version from 16.x to 18.16.1 and webpack version from 4.x to 5.x. and then configuring respective webpack.config.js file where facing MIME type issue and looks output file is not getting generated. yarn build and…
0
votes
0 answers

Plugin/Preset files are not allowed to export objects, only functions, while configuring the webpack

I am trying to configure webpack and babel from scratch. I am getting the following error. Can anyone help? I have attached the package.json screenshot. Plugin/Preset files are not allowed to export objects, only functions. Can any one see, if i am…
0
votes
0 answers

Uncaught ReferenceError: process is not defined! WEBPACK AND BABEL ERROR

my MERN project has some errors ("zlib" Module not found etc..), because of that, i added some codes in module.exports={ resolve:{....}} on my webpack.config.js file in my react node moduse folder (node_modules\react-scripts\config). resolve: { …
0
votes
0 answers

How do I configure webpack with WasmPackPlugin

After adding WasmPackPlugin the error appears const path = require("path"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin"); module.exports = { mode: "development", entry:…
0
votes
1 answer

webpack-cli Error: Conflict: Multiple chunks emit assets to the same filename

I am trying to generate my own webpack config and have some problems generate a bundle. Error: [webpack-cli] Error: Conflict: Multiple chunks emit assets to the same filename billing-dashboard-ui.js (chunks main and runtime) Changing my output…
AFAF
  • 569
  • 2
  • 16
  • 40