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.

144 votes
5 answers
19k views

Javascript object bracket notation ({ Navigation } =) on left side of assign

I haven't seen this syntax before and am wondering what it's all about. var { Navigation } = require('react-router'); The brackets on the left are throwing a syntax error: unexpected token { I'...
captainill's user avatar
  • 2,069
2355 votes
68 answers
3.0m views

Error message "error:0308010C:digital envelope routines::unsupported"

I created the default IntelliJ IDEA React project and got this: Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (...
a1cd's user avatar
  • 24.2k
502 votes
12 answers
377k views

Managing jQuery plugin dependency in webpack

I'm using Webpack in my application, in which I create two entry points - bundle.js for all my JavaScript files/codes, and vendors.js for all libraries like jQuery and React. What do I do in order to ...
booleanhunter's user avatar
340 votes
32 answers
532k views

The create-react-app imports restriction outside of src directory

I am using create-react-app. I am trying to call an image from my public folder from a file inside my src/components. I am receiving this error message. ./src/components/website_index.js Module not ...
David Brierton's user avatar
26 votes
3 answers
57k views

Why am I getting ReferenceError: self is not defined when I import a client-side library?

Trying to create an xterm react component in Next.js I got stuck as I'm not able to get over an error message I've never got before. I'm trying to import a npm client-side module called xterm, but if ...
Lord Reptilia's user avatar
174 votes
23 answers
257k views

Vue.js dynamic images not working with webpack

I have a case where in my Vue.js with webpack web app, I need to display dynamic images. I want to show img where file name of images are stored in a variable. That variable is a computed property ...
Saurabh's user avatar
  • 73.1k
394 votes
18 answers
407k views

Passing environment-dependent variables in webpack

I'm trying to convert an angular app from gulp to webpack. in gulp I use gulp-preprocess to replace some variables in the html page (e.g. database name) depending on the NODE_ENV. What is the best way ...
kpg's user avatar
  • 7,864
201 votes
7 answers
268k views

Define global variable with webpack

Is it possible to define a global variable with webpack to result something like this: var myvar = {}; All of the examples I saw were using external file require("imports?$=jquery!./file.js")
Teneff's user avatar
  • 31.7k
170 votes
6 answers
145k views

Dynamically import images from a directory using webpack

So here's my current workflow for importing images and icons in webpack via ES6: import cat from './images/cat1.jpg' import cat2 from './images/cat2.svg' import doggy from './images/doggy.png' import ...
klinore's user avatar
  • 2,699
13 votes
3 answers
30k views

CORS error even after setting Access-Control-Allow-Origin or other Access-Control-Allow-* headers on client side

I have a Vue application generated with webpack-simple option. I am trying to make a GET request to https://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en but I get the error: ...
wrahim's user avatar
  • 1,168
194 votes
9 answers
229k views

How do I use /deep/ or >>> or ::v-deep in Vue.js?

So, I've read here that in Vue.js, you can use /deep/ or >>> in a selector in order to create style rules that apply to elements inside of child components. However, attempting to use this in ...
laptou's user avatar
  • 6,795
439 votes
37 answers
648k views

How to Polyfill node core modules in webpack 5

webpack 5 no longer do auto-polyfilling for node core modules. How to fix it please? BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer ...
Saber's user avatar
  • 4,481
231 votes
14 answers
646k views

Correct path for img on React.js

I have some problem with my images on my react project. Indeed I always thought that relative path into src attribute was built on the files architecture Here my files architecture: components ...
onedkr's user avatar
  • 3,346
209 votes
14 answers
662k views

"You may need an appropriate loader to handle this file type" with Webpack and Babel

I am trying to use Webpack with Babel to compile ES6 assets, but I am getting the following error message: You may need an appropriate loader to handle this file type. | import React from 'react'; | /...
egidra's user avatar
  • 8,917
554 votes
19 answers
1.0m views

Getting Unexpected Token Export

I am trying to run some ES6 code in my project but I am getting an unexpected token export error. export class MyClass { constructor() { console.log("es6"); } }
Jason's user avatar
  • 5,597

15 30 50 per page
1
2 3 4 5
244