Questions tagged [webpack-4]

Use this tag for questions specific to features in Webpack 4. When using this tag, also include the more generic [webpack] tag where possible.

Use this tag for questions specific to features in Webpack 4. For general Webpack questions, the correct tag is .

Webpack 4 Big changes:

  • 4 is no longer supported.
  • configuration modes (--mode): production or development
  • configuration updates (plugins substitution by optimization config.)
    • NoEmitOnErrorsPlugin -> optimization.noEmitOnErrors
    • ModuleConcatenationPlugin -> optimization.concatenateModules
    • NamedModulesPlugin -> optimization.namedModules
    • CommonsChunkPlugin was removed -> optimization.splitChunks, optimization.runtimeChunk
  • native support
    • add type: "javascript/auto" when transforming JSON via loader to JS

Links

1410 questions
0
votes
2 answers

How to properly configure react with webpack-4 in development mode

I am getting an error code that is auto-generated when I use webpack and babel in a NodeJs React application: Uncaught ReferenceError: Invalid left-hand side in assignment Here is the offending line in the code auto-generated by…
ccalvert
  • 3,816
  • 1
  • 23
  • 22
0
votes
1 answer

Webpack 4 remove / strip some parts of html

I am using html-webpack-plugin to process html files. I need to remove some parts before i export for server. I found a couple plugins to do this but they are outdated or doesn't work with webpack 4. This is my config for html-webpack-plugin. I…
atilkan
  • 4,527
  • 1
  • 30
  • 35
-1
votes
1 answer

webpack 4 and create-react-app csp and new Function

webpack 4 appears to be adding code like this into the bundle try { n = n || new Function("return this")(); } catch (e) { "object" == typeof window && (n = window); } We have strict security which means this will fail csp…
dagda1
  • 26,856
  • 59
  • 237
  • 450
-1
votes
1 answer

Stubbing built-in nodejs modules in Webpack

I'm running some nodejs code via server side rendering. Specifically, I'm using the mini_racer gem for Ruby. I'm using webpack to bundle my Javascript files. I'm running into an issue where one my dependencies makes use of built-in nodejs modules…
-1
votes
1 answer

Can I disable style chunking while using dynamic import with webpack4 in Vue project?

I am using dynamic import and webpackChunkName in the router of my Vue project. The imported modules use some Vuetify components. Once I build the project I see some chunked CSS files which include duplicated content from the vendor CSS file. How…
David Vann
  • 72
  • 5
-1
votes
1 answer

Module not found: Error: Can't resolve 'Home'

I have just began learning React, and have stumbled upon this error while trying to build using webpack. Module not found: Error: Can't resolve 'Home' in 'D:\wamp64\www\Wallet\src\components' resolve 'Home' in…
Abhishek Jain
  • 630
  • 6
  • 26
-1
votes
1 answer

Write to file data from inputs

Need to write in txt file name, phone and film from inputs. I'm new in Node, so I can't do this easy task, help me please I tried to do it using fs module, but i cant use it in client side, so idk what to do with this problem. Project using webpack,…
Alex Khanas
  • 335
  • 1
  • 6
  • 15
-1
votes
1 answer

Is there a special configuration for using video (.mov, .mp4) locally and Webpack with 'file-loader'?

I am using webpack to build a basic site. Everything is working as far as images, sass, and loading of local fonts goes. I am now trying to load video from a local file however when i go to add it webpack is giving me a 404 error. Can anyone help me…
mangosing
  • 1
  • 1
-1
votes
1 answer

You may need an appropriate loader to handle this file type, with Webpack

I keep getting the following error when setting up webpack for my project. I already had my project built before webpack and I am just now setting it up so I can uglify my project. So excuse my ignorance on this. ERROR in…
Snoopy
  • 1,257
  • 2
  • 19
  • 32
-1
votes
1 answer

How to minify Lit-HTML (including comments)

I decided to try out lit-html via: npm install lit-html --save I've heard numerous times (from various sources) that lit-html is only 2 or 3KB in size, but by only importing the html and render exports it caused my webpack to grow over 13KB. That's…
Lonnie Best
  • 9,936
  • 10
  • 57
  • 97
-1
votes
1 answer

Why do I need css-loader?

I am new to webpack. Can anyone give me a simple explanation of why we do need the css loader? Can't I simply keep adding css file references into html tag? I could find information only about HOW TO use css loader, but WHY I should use it. I…
Octtavius
  • 563
  • 8
  • 29
-2
votes
1 answer

How to make SourceMaps work for 1p Packages with React and WebPack?

We have a bunch of 1p(First party) JS packages which are used across web and mobile (React Native App). One thing we have noticed is the source map only works for the base package and not for the 1p packages as those are node dependencies added at…
INFOSYS
  • 1,465
  • 9
  • 23
  • 50
-2
votes
1 answer

Npm package styles are not applying on class

I create my react npm package using webpack but when i install my npm package to my react project, package styles are not apply on classes. Why this happens Here is the link of npm package. You can install 0.0.5 version. In my webpack i used…
-2
votes
1 answer

How to debug webpack when bundling for production?

I'm currently working learning webpack and have a working development config but when trying to use that same config for production everything but the css bundles. assets master % node_modules/webpack/bin/webpack.js --display-optimization-bailout…
-2
votes
1 answer

Alternates for 'System.import '

After updating webpack, System.import start showing a deprecation error. if (typeof System === 'undefined' || typeof System.import === 'undefined') { global.System = {}; System.import = module => Promise.resolve(require(module)); } Below is the…
1 2 3
93
94