Questions tagged [webpack-2]

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

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

Webpack 2

Released in February 2016. Migrating instructions can be found in the documentation.

New Features

  • Tree Shaking (removal of unused code)
  • Expanded flexibility and configuration for loaders
  • Performance Budgets (highlight bundles that exceed 250kb in size)
1438 questions
42
votes
1 answer

Can't resolve 'babel-loader'

I am trying to configure my first node react app. I keep getting an error that says "Can't resolve babel-loader". Googling that error, I found a couple of suggestions which do not work. The first is to add the following to my webpack.config.js //…
Mel
  • 2,481
  • 26
  • 113
  • 273
40
votes
5 answers

Navigation Error in angular2

I have updated the angular packages version from 2.4.10 to 4.0.0 after updating i am getting the following errors while navigating. ERROR Error: Uncaught (in promise): Error: Found the synthetic property @transformPlaceholder. Please include either…
Vignesh
  • 2,378
  • 3
  • 25
  • 48
39
votes
3 answers

Webpack Exclude a specific file

I have this code In my webpack.config.prod.js and I was wondering how do I exclude all json except one in a specific path like src/configs/configs exclude: [ /\.html$/, /\.(js|jsx)$/, /\.css$/, /\.json$/, /\.bmp$/, /\.gif$/, …
user7768004
37
votes
8 answers

92% chunk asset optimization - webpack

It seems that webpack gets stuck on 92% chunk asset optimization for about 30+ seconds to show a simple js/css change. This is too long for anyone sane to sit and wait that much of their life to see something that should be rendered near…
Wonka
  • 8,244
  • 21
  • 73
  • 121
36
votes
1 answer

One project with multiple package.json files

I'm relatively new to modern JS development and I need help or advice about this situation I'm in. Situation: We have a React-Typescript-Redux project supporting IE8 (React 0.14). Now we're upgrading to IE11 and React 16 but IE8 should be…
skrunic
  • 897
  • 1
  • 7
  • 15
35
votes
3 answers

How to import CSS files into webpack?

According to the documentation, CSS file should just be imported. I am just starting with webpack and tried to import a CSS file but I get a message about a module missing: D:\Dropbox\dev\jekyll\blog>webpack --display-error-details Hash:…
WoJ
  • 27,165
  • 48
  • 180
  • 345
33
votes
5 answers

Vue is not a constructor

I using webpack, after build and run in chrome show this error,I don't know how to solve it. My code is very simple: { "devDependencies": { "babel-core": "^6.23.1", "babel-loader": "^6.3.2", "babel-plugin-transform-runtime":…
robincode
  • 570
  • 1
  • 5
  • 15
30
votes
4 answers

Webpack bundles my files in the wrong order (CommonsChunkPlugin)

What I want is to bundle my JavaScript vendor files in a specific order via CommonsChunkPlugin from Webpack. I'm using the CommonsChunkPlugin for Webpack. The usage from the official documentation is straight forward and easy. It works as intended…
Ollie Cee
  • 704
  • 1
  • 6
  • 14
29
votes
3 answers

webpack common chunks plugin vs webpack dll plugin

Before I used webpack common chunks plugin to create vendor bundle containing third party libraries like angular, react, lodash etc, but then I knew about webpack dll plugin. They seem do the same things but dll plugin also allows you to reduce…
pavel06081991
  • 629
  • 1
  • 8
  • 14
25
votes
4 answers

`Unexpected token import` in `webpack.config.babel.js` when using `{modules: false}`

I have a React project which uses Webpack as the module bundler, and babel-loader to transform it into ES5, using the following settings: module: { rules: [ { test: /\.jsx?$/, exclude: /node_modules/, use: [ { …
d4nyll
  • 11,811
  • 6
  • 54
  • 68
25
votes
1 answer

Why does webpack 2 bundle use `eval()` to wrap code?

I am just learning webpack. I notice in the resulting bundle.js it uses eval like this (when in "Development" mode, not "Production" which produces something completely different): function(module, exports, __webpack_require__) { "use…
Greg Gum
  • 33,478
  • 39
  • 162
  • 233
24
votes
3 answers

webpack dynamic module loader by require

OK, i have searched high and low but cannot reliably deterrmine if this is or is not possible with webpack. https://github.com/webpack/webpack/tree/master/examples/require.context Appears to indicate that one can pass a string to a function and it…
user1037355
23
votes
3 answers

google fonts + webpack

I am new to webpack 2.2 ; I would like to know the best way to integrate a Google font within my project. I am using the Webpack HTML plugin to generate an index.html from a template. So for the moment I hard-coded the Google font CSS directly in a…
mguijarr
  • 7,641
  • 6
  • 45
  • 72
22
votes
5 answers

How to run webpack-bundle-analyzer?

I installed webpack-bundle-analyzer and need to run it. How can I do it? I have several errors. One of the most common is Could't analyze webpack bundle
Roman
  • 19,236
  • 15
  • 93
  • 97
22
votes
1 answer

How to disable require-jsdoc eslint in webpack

Error : [eslint] Missing JSDoc comment. (require-jsdoc) I want to disable this error from webpack config so that it will not be displayed on the console.
Nouman Altaf
  • 289
  • 1
  • 2
  • 13
1
2
3
95 96