Questions tagged [webpack-3]

Version 3 of the Webpack bundler. Webpack takes modules with dependencies and generates static assets representing those modules.

About

Released in June 2017. Migrating from Webpack 2 to 3 should involve no effort beyond running the upgrade commands in your terminal.

New Features

  • Scope Hoisting
  • Dynamic Import Syntax

Links

GitHub

183 questions
0
votes
1 answer

minify multiple css files for angular 6 project using webpack

Angular 6 compresses the CSS file but didn't minify it. I need to minify CSS files. Currently I'm using these commands for production build. package.json "build": "run-s build:client build:aot build:server", "build:client": "ng build --prod…
0
votes
1 answer

Can't import TypeScript library bundled with WebPack

In a TypeScript project, I am trying to import a TypeScript library named "fsaa-util" that I bundled with WebPack. The code compiles fines but at runtime when trying to use an object from that library they're undefined. index.ts: import { MyClass }…
olivierr91
  • 1,243
  • 3
  • 13
  • 29
0
votes
0 answers

Can I reduce my bundle size using Webpack v3?

I've recently noticed that when I try to initially load my web application that it takes some time before every thing pops up (~15 seconds). I took a look at my network tab and noticed that it was my bundle.js file that was hogging up all the time.…
Michael
  • 1,454
  • 3
  • 19
  • 45
0
votes
1 answer

How to build multiple libraries under single output folder in Webpack

I have my webpack config as below entry : { lib: "./path/to/index", sublib: "./path/to/sub/index" }, output : { filename: "[name]/[name].lib.js", path: __dirname + "/dist", } It currently building in below folder structure - src | |-…
Amin Kodaganur
  • 646
  • 6
  • 19
0
votes
0 answers

Angular cli - import html as a module with a prefix. Webpack loader not working

I am using angular 6 and angular cli 1.7 with exported webpack, the requirement is to use amd module and import html on to the component. import * as html from 'text!./app.component.html'; @Component({ selector: 'app-root', template:…
Mathew
  • 49
  • 1
  • 3
0
votes
1 answer

Webpack especific css bundle

I have the following code in webpack 3.11 var path = require('path'); var webpack = require("webpack"); var HtmlWebpackPlugin = require('html-webpack-plugin'); const MinifyPlugin = require("babel-minify-webpack-plugin"); if…
0
votes
1 answer

React Webpack3: You may need an appropriate loader to handle this file type

I am trying to use Webpack3 with Babel to compile ES6 assets, but I am getting an error "You may need an appropriate loader to handle this file type." Below is the exact error that I am getting: ERROR in…
Eunicorn
  • 601
  • 6
  • 16
  • 29
0
votes
1 answer

Tree Shaking Lodash with Webpack 3.8.1

Lodash@4.17.4 Webpack@3.8.1 babel@7 babel-plugin-lodash@3.3.2 I use named imports when it comes to Lodash. I've configured @babel/preset-env with 'modules' set to false to prevent transpilation to Common JS and use 'lodash' as a plugin in the…
Mayur Arora
  • 447
  • 5
  • 11
0
votes
1 answer

Webpack 3: How do I add options to a chained loader?

// ... const webpack = require('webpack'); module.exports = function config(env, argv = {}) { return { // ... module: { loaders: [ { test: /\.jsx?$/, include: APP_DIR, loader:…
OZZIE
  • 6,609
  • 7
  • 55
  • 59
0
votes
1 answer

Export .eslintrc from webpack

It is possible share my .eslintrc config to be used in other projects? Below, my webpack.config.js mode: 'production', module: { rules: [ { test: /\.js$/, use: { loader: 'babel-loader', options: { …
FabianoLothor
  • 2,752
  • 4
  • 25
  • 39
0
votes
0 answers

Webpack 3 and React.lazy

I decided to use React.lazy in my React app (16.6.3) with React Router 4.3.1 for lazy loading with Webpack 3.12.0, but when I used it, I observed huge speed bundling decrease. In other words, now it takes about 7 times slower to rebuilt component…
turkus
  • 4,637
  • 2
  • 24
  • 28
0
votes
0 answers

process.env.NODE_ENV is not working with webpack3

I am trying to assign NODE_ENV to production using webpack3, and have tried the following code: environment.plugins.append( 'DefinePlugin', new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }) ) also tried:…
Julie
  • 1,941
  • 3
  • 17
  • 30
0
votes
1 answer

React Loadable requesting new css in dynamically loaded components

I'm using react loadable to code split off components. I'm also using Extract CSS Chunks to split my stylesheets up. Everything works great during server side rendering and the initial client side render, but when I transition to a new page and a…
Thomas
  • 2,356
  • 7
  • 23
  • 59
0
votes
0 answers

Webpack 3 => 4 upgrade *increased* build time and bundle size... Why?

So to upgrade from webpack 3 to 4 I took these steps: update npm packages: extract-text-webpack-plugin@4.0.0-beta.0 file-loader@2.0.0 html-webpack-plugin@3.0.0 webpack@4.6.0 webpack-dev-server@1.16.2 webpack-cli@3.1.0 Add Mode mode:…
Kevin Danikowski
  • 4,620
  • 6
  • 41
  • 75
0
votes
1 answer

Uncaught TypeError: Cannot read property 'propTypes' of undefined when using NODE_ENV=production webpack -p

I need help with webpack, version 3 and react, i've updated a package to a newer version and when i build it with NODE_ENV=production webpack -p it throws the Uncaught TypeError: Cannot read property 'propTypes' of undefined error but loads fine…
Beto
  • 772
  • 2
  • 12
  • 26