A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.

Overview


npm

node deps tests builds builds2 coverage licenses PR's welcome


install size

webpack

webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.

Table of Contents

  1. Install
  2. Introduction
  3. Concepts
  4. Contributing
  5. Support
  6. Core Team
  7. Sponsoring
  8. Premium Partners
  9. Other Backers and Sponsors
  10. Gold Sponsors
  11. Silver Sponsors
  12. Bronze Sponsors
  13. Backers
  14. Special Thanks

Install

Install with npm:

npm install --save-dev webpack

Install with yarn:

yarn add webpack --dev

Introduction

webpack is a bundler for modules. The main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.

TL;DR

  • Bundles ES Modules, CommonJS, and AMD modules (even combined).
  • Can create a single bundle or multiple chunks that are asynchronously loaded at runtime (to reduce initial loading time).
  • Dependencies are resolved during compilation, reducing the runtime size.
  • Loaders can preprocess files while compiling, e.g. TypeScript to JavaScript, Handlebars strings to compiled functions, images to Base64, etc.
  • Highly modular plugin system to do whatever else your application requires.

Get Started

Check out webpack's quick Get Started guide and the other guides.

Browser Compatibility

webpack supports all browsers that are ES5-compliant (IE8 and below are not supported). webpack also needs Promise for import() and require.ensure(). If you want to support older browsers, you will need to load a polyfill before using these expressions.

Concepts

Plugins

webpack has a rich plugin interface. Most of the features within webpack itself use this plugin interface. This makes webpack very flexible.

Name Status Install Size Description
mini-css-extract-plugin mini-css-npm mini-css-size Extracts CSS into separate files. It creates a CSS file per JS file which contains CSS.
compression-webpack-plugin compression-npm compression-size Prepares compressed versions of assets to serve them with Content-Encoding
html-webpack-plugin html-plugin-npm html-plugin-size Simplifies creation of HTML files (index.html) to serve your bundles

Loaders

webpack enables the use of loaders to preprocess files. This allows you to bundle any static resource way beyond JavaScript. You can easily write your own loaders using Node.js.

Loaders are activated by using loadername! prefixes in require() statements, or are automatically applied via regex from your webpack configuration.

Files

Name Status Install Size Description
raw-loader raw-npm raw-size Loads raw content of a file (utf-8)
val-loader val-npm val-size Executes code as module and considers exports as JS code
url-loader url-npm url-size Works like the file loader, but can return a Data Url if the file is smaller than a limit
file-loader file-npm file-size Emits the file into the output folder and returns the (relative) url

JSON

Name Status Install Size Description
cson-npm cson-size Loads and transpiles a CSON file

Transpiling

Name Status Install Size Description
babel-npm babel-size Loads ES2015+ code and transpiles to ES5 using Babel
traceur-npm traceur-size Loads ES2015+ code and transpiles to ES5 using Traceur
type-npm type-size Loads TypeScript like JavaScript
coffee-npm coffee-size Loads CoffeeScript like JavaScript

Templating

Name Status Install Size Description
html-npm html-size Exports HTML as string, requires references to static resources
pug-npm pug-size Loads Pug templates and returns a function
md-npm md-size Compiles Markdown to HTML
posthtml-npm posthtml-size Loads and transforms a HTML file using PostHTML
hbs-npm hbs-size Compiles Handlebars to HTML

Styling

Name Status Install Size Description
<style> style-npm style-size Add exports of a module as style to DOM
css-npm css-size Loads CSS file with resolved imports and returns CSS code
less-npm less-size Loads and compiles a LESS file
sass-npm sass-size Loads and compiles a Sass/SCSS file
stylus-npm stylus-size Loads and compiles a Stylus file
postcss-npm postcss-size Loads and transforms a CSS/SSS file using PostCSS

Frameworks

Name Status Install Size Description
vue-npm vue-size Loads and compiles Vue Components
polymer-npm polymer-size Process HTML & CSS with preprocessor of choice and require() Web Components like first-class modules
angular-npm angular-size Loads and compiles Angular 2 Components
riot-npm riot-size Riot official webpack loader

Performance

webpack uses async I/O and has multiple caching levels. This makes webpack fast and incredibly fast on incremental compilations.

Module Formats

webpack supports ES2015+, CommonJS and AMD modules out of the box. It performs clever static analysis on the AST of your code. It even has an evaluation engine to evaluate simple expressions. This allows you to support most existing libraries out of the box.

Code Splitting

webpack allows you to split your codebase into multiple chunks. Chunks are loaded asynchronously at runtime. This reduces the initial loading time.

Optimizations

webpack can do many optimizations to reduce the output size of your JavaScript by deduplicating frequently used modules, minifying, and giving you full control of what is loaded initially and what is loaded at runtime through code splitting. It can also make your code chunks cache friendly by using hashes.

Contributing

We want contributing to webpack to be fun, enjoyable, and educational for anyone, and everyone. We have a vibrant ecosystem that spans beyond this single repo. We welcome you to check out any of the repositories in our organization or webpack-contrib organization which houses all of our loaders and plugins.

Contributions go far beyond pull requests and commits. Although we love giving you the opportunity to put your stamp on webpack, we also are thrilled to receive a variety of other contributions including:

  • Documentation updates, enhancements, designs, or bugfixes
  • Spelling or grammar fixes
  • README.md corrections or redesigns
  • Adding unit, or functional tests
  • Triaging GitHub issues -- especially determining whether an issue still persists or is reproducible.
  • Searching #webpack on twitter and helping someone else who needs help
  • Teaching others how to contribute to one of the many webpack's repos!
  • Blogging, speaking about, or creating tutorials about one of webpack's many features.
  • Helping others in our webpack gitter channel.

To get started have a look at our documentation on contributing.

If you are worried or don't know where to start, you can always reach out to Sean Larkin (@TheLarkInn) on Twitter or simply submit an issue and a maintainer can help give you guidance!

We have also started a series on our Medium Publication called The Contributor's Guide to webpack. We welcome you to read it and post any questions or responses if you still need help.

Looking to speak about webpack? We'd love to review your talk abstract/CFP! You can email it to webpack [at] opencollective [dot] com and we can give pointers or tips!!!

Creating your own plugins and loaders

If you create a loader or plugin, we would <3 for you to open source it, and put it on npm. We follow the x-loader, x-webpack-plugin naming convention.

Support

We consider webpack to be a low-level tool used not only individually but also layered beneath other awesome tools. Because of its flexibility, webpack isn't always the easiest entry-level solution, however we do believe it is the most powerful. That said, we're always looking for ways to improve and simplify the tool without compromising functionality. If you have any ideas on ways to accomplish this, we're all ears!

If you're just getting started, take a look at our new docs and concepts page. This has a high level overview that is great for beginners!!

Looking for webpack 1 docs? Please check out the old wiki, but note that this deprecated version is no longer supported.

If you want to discuss something or just need help, here is our Gitter room where there are always individuals looking to help out!

If you are still having difficulty, we would love for you to post a question to StackOverflow with the webpack tag. It is much easier to answer questions that include your webpack.config.js and relevant files! So if you can provide them, we'd be extremely grateful (and more likely to help you find the answer!)

If you are twitter savvy you can tweet #webpack with your question and someone should be able to reach out and help also.

If you have discovered a 🐜 or have a feature suggestion, feel free to create an issue on Github.

License

FOSSA Status

Core Team


Tobias Koppers

Core


Founder of webpack


Johannes Ewald

Loaders & Plugins


Early adopter of webpack


Sean T. Larkin

Public Relations


Founder of the core team


Kees Kluskens

Development


Sponsor


Sponsoring

Most of the core team members, webpack contributors and contributors in the ecosystem do this open source work in their free time. If you use webpack for a serious task, and you'd like us to invest more time on it, please donate. This project increases your income/productivity too. It makes development and applications faster and it reduces the required bandwidth.

This is how we use the donations:

  • Allow the core team to work on webpack
  • Thank contributors if they invested a large amount of time in contributing
  • Support projects in the ecosystem that are of great value for users
  • Support projects that are voted most (work in progress)
  • Infrastructure cost
  • Fees for money handling

Premium Partners

Other Backers and Sponsors

Before we started using OpenCollective, donations were made anonymously. Now that we have made the switch, we would like to acknowledge these sponsors (and the ones who continue to donate using OpenCollective). If we've missed someone, please send us a PR, and we'll add you to this list.

Angular MoonMail MONEI

Gold Sponsors

Become a gold sponsor and get your logo on our README on Github with a link to your site.

Silver Sponsors

Become a silver sponsor and get your logo on our README on Github with a link to your site.

Bronze Sponsors

Become a bronze sponsor and get your logo on our README on Github with a link to your site.

Backers

Become a backer and get your image on our README on Github with a link to your site.

Special Thanks to

(In chronological order)

Comments
  • webpack 5 beta feedback

    webpack 5 beta feedback

    :tada: Thanks for being brave and donating your valuable time to testing unfinished beta software :tada:

    webpack 5 is in beta phase now. This means major changes and features are done. Major breaking changes have been added. Basic backward-compatibility has been added.

    We want to use the beta phase to do the following:

    • Let a boarder range of users test the beta version.
    • Find bugs in new features.
    • Find regressions in old features.
    • Find places where a compat-layer can be added to avoid breaking changes.
    • Improve the migration guide and changelog.

    We want to reach these goals after the beta phase:

    • Old features are very stable
    • New features are a bit stable
    • Backward-compatibility layer allows most existing plugins/loader to work unmodified (potentially with deprecation warnings)
    • There clear way how to migrate from webpack 4 to 5
    • There are experimental webpack 5 branches for higher-level tools (like angular-cli, vue-cli, create-react-app, ...) (at least 2)

    To help with testing you can do the following:

    • Always test with the latest webpack beta version, as problems might already be fixed there
    • When using webpack directly:
      • Follow the migration guide
      • Report or add missing steps in the migration guide
      • Report problems during the migration
      • Report problems with the build after the migration
    • When using a higher-level tool:
      • Check if there is a branch/Pull Request for webpack 5
      • Follow guide there
      • Report problems in the Pull Request
    • Make sure to also report (positive) experience
      • Performance comparison
      • Size comparison
      • DX comparison
    • Try new features
      • Enable persistent caching -> guide
      • Enable Top Level Await
      • Enable the new asset module type
      • Enable Long Term Caching
      • Try to break filesystem watching
    • Trace back deprecation warnings with node --trace-deprecation
      • Help upgrading plugins/loaders
    • Make sure to follow beta releases
      • Retest newer version to avoid regressions in beta versions
    • Consider sponsoring webpack when this version
      • increases your productivity with better build performance
      • increases your productivity with better developer experience
      • increases your consumer happiness with better application performance
      • make you happy in some other way...

    Known problems:

    • eval() causes problems with the optimization.innerGraph (production).
    • libraryTarget: "module" is not implemented yet
    • devtools don't support persistent caching yet
    • Persistent Cache file include absolute paths are are not portable yet
    • import.meta is still missing
    • prefetching doesn't work for WASM yet
    • CLI arguments doesn't contribute to cache version
    • ~stack trace is incorrectly displayed in stats~
    • Build Time is a bit higher for non-cached builds. Possible reasons:
      • tracking extra information in the resolver for safe caching
    • mini-css-extract-plugin is not able to persistent cache yet
    • https://github.com/webpack-contrib/stylelint-webpack-plugin/issues/187
    • svg-sprite-loader doesn't work
    • There is no warning for Buffer or process yet.

    Planned breaking changes:

    • ~devtool options will be more restrictive~
    • Internal HMR API for plugins will probably change
    • ~Disable some webpack-only syntax by default: require.ensure, require.include~
    • terser-webpack-plugin will be upgraded
    • ~cache.store != "pack" will be removed~
    webpack-5 
    opened by sokra 507
  • Merge Proposal: Module federation and code sharing between bundles. Many builds act as one

    Merge Proposal: Module federation and code sharing between bundles. Many builds act as one

    This is a proposal to merge my existing work into the Webpack core. The base concept is federated application orchestration at runtime. What I hope will provide a new era for how we build apps at scale.

    Due to the demand for more information, we have created a site that consolidates all content

    https://module-federation.github.io/

    https://github.com/module-federation/module-federation-examples

    https://github.com/webpack/changelog-v5/blob/master/guides/module-federation.md

    Feature request

    @sokra as requested, I've opened a new issue for us to discuss planning and implementation.

    This is the evolution of my original issue: https://github.com/webpack/webpack/issues/8524 edit: a better way to explain the request. I want the webpack equivalent of Apollos federation concept. I want to share resources between separate bundles at runtime. Similar to DLL plugin but without needing to provide Static build context , and I want to do this at runtime in the browser. Not at build time. Thus enabling tech like micro-frontends to be efficient, easy to manage, and most importantly - erase page reloads between separate apps and Enable independent deploys of standalone applications.

    For context, I've already implemented this feature request with great success. I feel this would have a major impact on frontend applications. I am proposing to refactor/rewrite my project and introduce it into the Webpack core. https://github.com/ScriptedAlchemy/webpack-external-import

    What is the expected behavior? import('website-one/MegaNav') require('website-one/MegaNav')

    • I expect to be able to require modules or chunks from other Webpack bundles hosted elsewhere.
    • I don't want to manage externals and worry about synchronizing them across systems
    • I don't want a single point of failure, like a commons chunk
    • I want to load code from another build, like dynamic imports and code-splitting
    • I want multiple builds to look and feel like a monolith in the client
    • I am able to deploy frontend apps independently and expect Webpack to orchestrate at runtime
    • I don't want to use less integrated/framework oriented solutions like SingleSPA, browser events, service workers - I want to use Webpack as the host container for foreign chunks and modules, not load other app entry points, but rather load other apps chunks and use those modules
    • If desired, an entire company should be able to federate code across every UI, from user-facing to backend. Effectively turning a multi build, multi team, multi mono-repo company into one SPA in the browser. Removing the need for page reloads or downloading additional code and bundles containing mostly the same node modules

    What is motivation or use case for adding/changing the behavior? This would offer a major shift in frontend architecture. Apps are getting larger and code-splitting on its own is not as effective with things such as micro-frontend technology.

    All current solutions on the market are substandard - working around the problem instead of addressing it. Application interleaving at runtime enables many new avenues for engineering.

    Heres some:

    • Applications can be self-healing, in the event there is a network failure - one could query other interleaved apps and load their copy of the missing dependency. This would solve deploy issues where pages break for a moment as the new code replaced old
    • Code can be distributed and managed by the team maintaining it, with options for evergreen code. Navigation, Pages, Routers - could be managed and deployed by the team who owns it - others would not have to redeploy their applications to get updates
    • Smaller bundles - interleaved apps wouldn't download chunks if Webpack already has the modules required by the interleaved app or fragment.
    • Easy and feasible micro-frontends - the tech right now involves some serious management and time to build supporting infrastructure
    • Shareable configs - interleave FE configurations without the need to rebundle or expose multiple configs.
    • Avoid long & slow builds due to the size of the monorepo. This would enable smaller builds and faster deploys with less coordination across teams
    • Introduction of "micro-service functions" modeling something similar to what backend engineers get to enjoy.
    • Better AB testing and marketing tooling. Right now AB tests are managed via a tag manager, plastering vanilla JS onto the dom which is usually not optimized, pollifilled, or compatible with how much javascript apps are written today. Markering teams and AB teams would write native components without having to get in the way of team delivery.
    • Better analytics - Tag managers and analytics engineers could write system native modules that could be woven into codebases. Most depend on some plugin or just reading the DOM. Interleaving would open a new world of slick integration.
    • third party modules - vendors could take advantage of this tech and offer managed modules instead of inefficient scripts - they'd still be secure but would have a new way of implementation. Iframes could be avoided in some cases
    • no global pollution of the window, globals can be accessed via the Webpack runtime
    • as more apps are interleaved, they too can supply their modules to another interleaved app, resulting in less and less code needing to be downloaded as more and more modules are added to webpack

    The use cases are limitless, I've only begun to imagine possibilities.

    Webpack is more than capable of doing this without needing any big changes to the core. Both 4 and 5 already have what I need.

    How should this be implemented in your opinion? Seeing as I've already done it. I have a clear picture of how to implement it. However, it can be improved with some guidance. I hold little opinion over the solution, as long as it offers a similar outcome.

    1. Add an additional require extension which can support interleaving. I'm currently using a slightly modified version of requireEnsure which already works very well with Webpacks chunk and module loading / caching. when requiring an interleaved module - users would specify a pattern like /<module.id> - Because my current solution is based on requireEnsure, it's pretty robust and not hacky. To handle CSS I've also taken the code template from mini-css to support side-effect loading.
    2. Output an unhashed JS file that can be embedded onto other apps. This file would contain a small mapping of chunk.id to the cache busted file name.
    3. Hashed module ids based on contents + package.json version of dependency + usedExports to support tree-shaken code. Hashing needs to be effective at avoiding collisions as well as to support tree-shaken code. Hashing enables effective code sharing and prevents overwriting existing modules. Ideally, if there's an option to update module id after optimization - it would likely improve the reliability of hashing. However, I have not encountered any problems. Open to alternative solutions. This hashing mechanism I am using is used by amazon who built a CLI to orchestrate code sharing across the company.
    4. A slight addition to the chunk template to include some registration data or another function similar to webpackJsonp.push which registers chunks and provides some metadata to Webpack Heres what it would include:
    • compilation hash: to detect if this chunk is being loaded by the build that created it, if so, no additional processing is needed
    • an array of additional chunk.id's required by the current chunk
    • a list of module ids which allow Webpack to determine if it has all modules required by the chunk about to be interleaved. Webpack would use a lazy find to search modules for the first instance of a missing module.id. At which point Webpack would load the extra chunk needed to fulfill any missing modules it does not already have
    1. an interface similar to externals, where a developer can specify what files/modules they intend to make available for interleaving. During the build, Webpack would not hash these module.ids, but instead, make the id be whatever the key is. Allowing humans to call the module by a predictable name. All dependencies of a module and all modules, in general, would be hashed - ensuring that nested dependencies can be tree shaken and will only use existing modules in Webpack if they are an exact match.
    2. Some automatic chunk splitting which would ensure interleaved files are placed into their own cache group. I also recommend chunking vendor bundles and any loader JS code out of the main chunk in order to avoid interleaving the entry point because of something like css-loader getting grouped into the main chunk. In order to prevent downloading a massive 200kb chunk, I am suggesting that there be some default limit for maxSize set on cache groups. Something along the lines of enabling aggressive code-splitting by default if interleaving is enabled. The goal is a happy medium between not downloading dozens of chunks and not downloading a massive chunk for one or two modules the host build cannot supply.
      "interleave": {
        "TitleComponent": "src/components/Title/index.js",
        "SomeExternalModule": "src/components/hello-world/index.js"
      }
    
      plugins: [
        new WebpackExternalImport({
          manifestName: "website-one"
        })
      ];
    

    Which would be used in consumer apps like this: require.interleaved('website-one/TitleComponeent')

    For better understanding, I suggest reading the links below. Please note that I am aware of many of the less elegant parts of the codebase and eager to improve the implementation to meet internal standards of Webpack (perf, bundle size, implementation strategy, better hooks to use)

    • https://github.com/ScriptedAlchemy/webpack-external-import
    • https://github.com/ScriptedAlchemy/webpack-external-import/blob/master/src/webpack/interleaveFn.js
    • https://github.com/ScriptedAlchemy/webpack-external-import/blob/master/src/webpack/chunkSplitting.js
    • https://github.com/ScriptedAlchemy/webpack-external-import/blob/master/src/webpack/optimizeChunk.js

    Are you willing to work on this yourself? yes - I have been contributing to Webpack since v1 and have a deep understanding of its API. I'd like to be the one to bring this feature to the wider JS community as well as to Webpack. I've built multiple large scale MFEs, some consisting of over 100 MFE's at one company. I am very familiar with the challenges and alternative methods to chunk federation/interleaving - all of them are terrible.

    While this solution might not be for everyone, it will have major value to massive corporations consisting of hundreds of teams of FE stacks. I am also able to test implementation updates against my own userbase - providing additional assurance to Webpack. I used the same approach when merging extract-css-chunks with mini-css (bringing HMR to mini-css)

    Current results I've been using this system for AB tests, Next.js apps, and config sharing at scale. In a simple comparison. Interleaving three separate React apps produced only 320kb of code transferred (1.2mb uncompressed) compared to 4mb using traditional solutions available on the market.

    Extra considerations

    • Whitelisting instructions that would enable developers to tell Webpack to use the "host build's" version of a dependency. Cases like React where I can't have two on the page - I want to offer the option to have a chunk use the version already installed, even if its a patch version different.
    • Hashing bloats builds: I'm looking for an alternative solution to hashing to give the community options, however, the savings of code sharing drastically outweigh any overhead in my opinion. 4mb to 1.2mb speaks for itself.
    • Chunk manifests are inside the chunk - this could be in one single file to produce a single manifest, however, I like the idea of code splitting chunk needs into the chunk themselves. This would make the actual manifest file very small as all it looks up is chunk names to URL paths. Seeing as the manifest is either cache busted with Date.now or 304 cache control - I wanted to keep it lean in the event developers don't want to deal with cache headers and just cache bust the 2kb file on each page load. This would introduce one extra loading wave, as once the chunk is downloaded, it would specify what it needs, triggering Webpack to then download any additional files in one call. Download chunk->download any chunks containing modules Webpack host build cannot provide. Nested chunks would not create more loading waves as the chunk metadata contains a thorough map of what it needs in totality

    SSR Update: because this is not only a browser implementation - you are more than able to federate modules via common js and shared directory or volumes on s3 or some other store that system. Alternatively, one could npm install a node version of the dependency at CI, treating the federated code (which is bundled so there’s no need for nested npm installs) to install the latest copy at deploy rendering most recent deploy of it - but at runtime the most updated Versions are available.

    Ultimately- if you use module federation for the node build and were to have a shared disk that a lambda could read from, you’d be able to require other code deployed, in the exact same manner as you do on the frontend.

    Send a PR 
    opened by ScriptedAlchemy 398
  • webpack 5 alpha feedback

    webpack 5 alpha feedback

    🎄 First, thanks for trying and giving feedback to our alpha version. 🎄

    Note that it's still in an early state and stuff may be broken. This is something you want to report here, as we don't want this to happen in the final release.

    Note that the major version has breaking changes and some plugins might no longer work as expected. We try to provided compatibility layers when possible, but some of the changes make this difficult (especially regarding injection additional runtime code). If some plugin isn't working this is also something you should report here to we are at least aware of it and may work on fixing it or adding a compatibility layer.

    Here is the full Changelog. Make sure to read at least until the configuration changes to be up-to-date.

    If you find something missing in the changelog, this is also something to report here. Easy fixes can made directly in the repo. Every webpack contributor has write access, otherwise send a PR.

    If everything is working great, that's also nice to hear. If you are trying the Persistent Caching feature, we would love to see numbers.

    Please make sure to try with the lastest alpha version before reporting, as it may already be fixed. You can use the npm dist-tag next to reference the latest alpha version.

    package.json "webpack": "next". Update with yarn upgrade webpack / npm update webpack.

    Not to forget: Thanks for everybody contributed to this version (@byzyk, @cacheflow, @Connormiha, @fscherwi, @guybedford, @michael-ciniawsky, @niieani, @ooflorent, @SevInf, @smelukov, @sodatea, @sokra, @xtuc). 🎉


    Feedback summary:

    • [x] mini-css-extract-plugin is incompatible (RuntimeModules change)
    • [x] fork-ts-checker-webpack-plugin is incompatible (frozen hooks)
    • [ ] circular-dependency-plugin is incompatible (dep.module removed)
    • [x] cache-loader is no longer needed
    • [x] webpack-cli misses Stats.presetToOptions (should use compilation.createStatsOptions)
    • [x] html-webpack-plugin misses fileTimestamps (should use fileSystemInfo)
    • [x] null prototype objects can't be serialized
    • [x] Deprecation warning for the HMR defaults
    • [ ] Docs need update
    • [x] namedChunkGroups have weird keys
    • [x] MultiStats.toJson fails without options argument (#8561)
    • [x] Stats assetsByChunkName is different to v4
    • [x] node.global: false causes many errors
    • [x] define is missing require requirement for module
    • [ ] reasons for scope-hoisted modules are inconsistent
    • [x] resolve.alias false doesn't work
    • [x] Source map caching is very slow
    • [x] Runtime modules duplicated in runtime chunk single
    • [ ] Compilation.rebuildModule broken in alpha
    webpack-5 
    opened by sokra 282
  • Uncaught TypeError: Cannot read property 'call' of undefined

    Uncaught TypeError: Cannot read property 'call' of undefined

    I'm having an issue with webpack where if I stop watching and restart, it will build just fine, but if I edit a file and save it, the incremental build fails with this error:

    Uncaught TypeError: Cannot read property 'call' of undefined

    Hunting it down there's a module that does not get included in the incremental change build. Best guess is the path followed to re-make the bundle file is not being followed correctly. Upon re-running (stop and start), the missing module is included.

    webpack.config.js (module names changed to protect the innocent):

    var webpack = require("webpack"),
        path = require('path')
        ;
    
    module.exports = {
      entry: {
        Entry1: "./app/Entry1.js",
        Entry2: "./app/Entry2.js",
        Entry3: "./app/Entry3.js",
        Entry4: "./app/Entry4.js",
        Entry5: "./app/Entry5.js",
        Entry6: "./app/Entry6.js",
        Entry7: "./app/Entry7.js",
        Entry8: "./app/Entry8.js",
      },
      output: {
        path: path.join(__dirname, "public/js"),
        filename: "[name].bundle.js",
        chunkFilename: "[id].chunk.js"
      },
      module: {
        loaders: [
          {test: /\.js$/, loader: 'jsx-loader'}
        ]
      },
        plugins: [
            new webpack.optimize.CommonsChunkPlugin("shared.js")
        ]
    };
    
    bug S2: Inconvenient P2: Very Important 
    opened by kfancy 264
  • nodejs 17: digital envelope routines::unsupported

    nodejs 17: digital envelope routines::unsupported

    Bug report

    What is the current behavior?

    [webpack-cli] Error: error:0308010C:digital envelope routines::unsupported
        at new Hash (node:internal/crypto/hash:67:19)
        at Object.createHash (node:crypto:130:10)
        at BulkUpdateDecorator.hashFactory (/opt/src/node_modules/webpack/lib/util/createHash.js:155:18)
        at BulkUpdateDecorator.digest (/opt/src/node_modules/webpack/lib/util/createHash.js:80:21)
        at /opt/src/node_modules/webpack/lib/DefinePlugin.js:595:38
        at Hook.eval [as call] (eval at create (/opt/src/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:100:1)
        at Hook.CALL_DELEGATE [as _call] (/opt/src/node_modules/tapable/lib/Hook.js:14:14)
        at Compiler.newCompilation (/opt/src/node_modules/webpack/lib/Compiler.js:1053:26)
        at /opt/src/node_modules/webpack/lib/Compiler.js:1097:29
        at Hook.eval [as callAsync] (eval at create (/opt/src/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1) {
      opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
      library: 'digital envelope routines',
      reason: 'unsupported',
      code: 'ERR_OSSL_EVP_UNSUPPORTED'
    }
    

    Other relevant information: webpack version: 5.59.0 Node.js version: 17.0.0 Operating System: linux x64

    webpack-4 webpack-5 critical-bug 
    opened by akornatskyy 238
  • Source Maps don't work on Chrome

    Source Maps don't work on Chrome

    Hello everyone, I just started to use webpack and I'm having serious issues in debugging my code. The problem is that the Chrome debugger doesn't work properly. I'm not sure if this is a webpack issue, a Chrome issue or my fault.

    This is my webpack file

    
    var webpack = require('webpack');
    
    module.exports = {
      entry: [
        './app',
      ],
      output: {
        path: __dirname + '/assets',
        publicPath: '/assets',
        filename: 'app.js',
      },
      devServer: {
        contentBase: __dirname + '/assets',
        host: '0.0.0.0',
        port: process.env.PORT,
        historyApiFallback: true,
        watchOptions: {
          aggregateTimeout: 300,
          poll: 1000,
        }
      },
      cache: true,
      devtool: 'inline-source-map',
      plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new webpack.DefinePlugin({
          'process.env.NODE_ENV': '"development"',
        }),
      ],
      module: {
        preLoaders: [
        ],
        loaders: [
          {
            test: /\.js$/,
            include: [ __dirname ],
            exclude: /node_modules/,
            loader: 'babel-loader',
          },
        ],
      },
      node: {
        fs: 'empty',
      },
    };
    

    By changing the devtool option I get different behaviours:

    • eval: the debugger works correctly but the code is really hard to debug because I see the transpiled code
    • source-map: When I set a brekpoint in a certain line, chrome often moves that breakpoint in another line. When I use the step over functionality, chrome shows me the wrong line even though the line where I stopped the execution was correct (usually the debugger moves the execution indicator where the function is declared)
    • hidden-source-map: same as eval
    • inline-source-map: same as source-map
    • eval-source-map: The debugger adds the breakpoints on the correct line, but the execution never stops. This seems to be connected to #740
    • cheap-source-map: same as eval
    • cheap-module-source-map: same as source-map

    I've tried to search both Chrome and Webpack related issues, changing browser or anything else it comes in my mind without success.

    question 
    opened by bolismauro 226
  • Vendor chunkhash changes when app code changes

    Vendor chunkhash changes when app code changes

    I'm trying to split my vendor code from my app code and got it all working. However, every time I change some code in my app and create a new build, the vendor file gets a new chunkhash and thus is downloaded by the clients again. The contents are exactly the same though.

    Here is a fully working small example showing the problem: https://github.com/kevinrenskers/chunkhash-problem

    And as you can see, the contents of these files are 100% identical even though the chunkhash keeps changing:

    screen shot 2015-07-30 at 22 47 59

    bug X4: work required S2: Inconvenient P1: Urgent 
    opened by kevinrenskers 183
  • Parsing of `import()` fails in 4.29.0 (Compilation issue, related to dynamic import)

    Parsing of `import()` fails in 4.29.0 (Compilation issue, related to dynamic import)

    Bug report

    What is the current behavior?

    I've updated to v4.29.0, and my code is no longer compiling.

    Error:

    Module parse failed: Unexpected token (11:10)
    You may need an appropriate loader to handle this file type.
    |       var AsyncHome = asyncComponent(appendAsyncReducer, epicSubject$, function () {
    |         return process.env.SERVER ? require('./home')
    >         : import(
    |         /* webpackChunkName: "books" */
    |         './home');
     @ ./server/ssr.js 15:0-34 167:25-34
     @ ./server/index.js
    

    If I revert to v4.28.2, it works again.

    If the current behavior is a bug, please provide the steps to reproduce.

    1. Clone https://github.com/Dbuggerx/react-book-search-sample.git
    2. npm i and compile the code (npm run start-server or npm run start) - it should work
    3. Now, install webpack v4.29.0 and try to compile again

    What is the expected behavior? It should compile the code without errors, as it was doing on v4.28.2

    Other relevant information: webpack version: v4.29.0 Node.js version: v10.15.0 Operating System: Fedora linux 29

    opened by Dbuggerx 171
  • CSS resolving order

    CSS resolving order

    Hi!

    I have two files

    require('bootstrap.css')
    require('./myfile.css')
    

    where the file bootstrap.css needs to be loaded before ./myfile.css. Is there any way to do set the CSS resolving order properly in webpack for CSS?

    bug question 
    opened by gunta 169
  • Tree shaking completely broken?

    Tree shaking completely broken?

    updated with the latest versions (29.06.2017) Webpack - 3.0.0 Babel-preset-env - 1.5.2 Node - 8.1.2 OS X - 10.12.5

    Current

    Tree shaking is not removing imports, not used in the app.

    Expected

    Tree shaking, removing not used imports.


    The test case is a simple app with React & React Router v4. Link component is not used, but the whole router package is bundled.

    import React from 'react'
    import ReactDOM from 'react-dom'
    import { Link } from 'react-router-dom'
    
    ReactDOM.render(
      <p>Hey</p>,
      document.getElementById('app')
    )
    

    Webpack & Rollup test repo

    bug S4: Broken P1: Urgent X3: discussion required 
    opened by vladshcherbin 163
  • Webpack4 has memory leak in development mode

    Webpack4 has memory leak in development mode

    Do you want to request a feature or report a bug? bug

    What is the current behavior? The memory increased when running webpack4 in development, and the memory didn't release. So there was memory leak. Then node will throw error JavaScript heap out of memory I saw the heapsnapshot, there was many repeated String Objects which were compiled by webpack. If the current behavior is a bug, please provide the steps to reproduce. run webpack development mode with , update the business code and waiting rebuild, then update the code...you will see the increasing memory.

    What is the expected behavior? Clear memory in time. If this is a feature request, what is motivation or use case for changing the behavior?

    Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System. [email protected]

    opened by zD98 156
  • how to compatiable with `exports` fileds in webpack 4.x

    how to compatiable with `exports` fileds in webpack 4.x

    I've met an issue that my npm package (foo for example) need to be used in both webpack4.x and webpack5.x

    how to let webpack4.x recognize exports fileds?

    Also I can't import through specific path(node_modules path) like foo/bar/baz.js in webpack5.x, got an error path ./bar/baz.js not exported from package

    opened by HomyeeKing 0
  • chore(deps-dev): bump husky from 6.0.0 to 8.0.3

    chore(deps-dev): bump husky from 6.0.0 to 8.0.3

    Bumps husky from 6.0.0 to 8.0.3.

    Release notes

    Sourced from husky's releases.

    v8.0.3

    • fix: add git not installed message #1208

    v8.0.2

    • docs: remove deprecated npm set-script

    v8.0.1

    • fix: use POSIX equality operator

    v8.0.0

    What's Changed

    Feats

    • feat: add husky - prefix to logged global error messages by @​joshbalfour in typicode/husky#1092
    • feat: show PATH when command not found to improve debuggability
    • feat: drop Node 12 support
    • feat: skip install if $HUSKY=0

    Fixes

    Docs

    Chore

    v7.0.4

    No changes. Husky v7.0.3 was reverted, this version is the same as v7.0.2.

    v7.0.2

    Fix pre-commit hook in WebStorm (#1023)

    v7.0.1

    • Fix gracefully fail if Git command is not found #1003 (same as in v6)

    v7.0.0

    • Improve .husky/ directory structure. .husky/.gitignore is now unnecessary and can be removed.
    • Improve error output (shorter)
    • Update husky-init CLI
    • Update husky-4-to-7 CLI
    • Drop Node 10 support

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    PR: unreviewed dependencies 
    opened by dependabot[bot] 1
  • HMR issues with ESM

    HMR issues with ESM

    This file has a problem with ES module: https://github.com/webpack/webpack/blob/main/hot/poll.js

    image

    As per https://webpack.js.org/api/hot-module-replacement/ it should have conditional switch to import.meta.webpackHot

    opened by nick4fake 0
  • chore(deps-dev): bump json5 from 2.2.0 to 2.2.3

    chore(deps-dev): bump json5 from 2.2.0 to 2.2.3

    Bumps json5 from 2.2.0 to 2.2.3.

    Release notes

    Sourced from json5's releases.

    v2.2.3

    v2.2.2

    • Fix: Properties with the name __proto__ are added to objects and arrays. (#199) This also fixes a prototype pollution vulnerability reported by Jonathan Gregson! (#295).

    v2.2.1

    • Fix: Removed dependence on minimist to patch CVE-2021-44906. (#266)
    Changelog

    Sourced from json5's changelog.

    v2.2.3 [code, diff]

    v2.2.2 [code, diff]

    • Fix: Properties with the name __proto__ are added to objects and arrays. (#199) This also fixes a prototype pollution vulnerability reported by Jonathan Gregson! (#295).

    v2.2.1 [code, diff]

    • Fix: Removed dependence on minimist to patch CVE-2021-44906. (#266)
    Commits
    • c3a7524 2.2.3
    • 94fd06d docs: update CHANGELOG for v2.2.3
    • 3b8cebf docs(security): use GitHub security advisories
    • f0fd9e1 docs: publish a security policy
    • 6a91a05 docs(template): bug -> bug report
    • 14f8cb1 2.2.2
    • 10cc7ca docs: update CHANGELOG for v2.2.2
    • 7774c10 fix: add proto to objects and arrays
    • edde30a Readme: slight tweak to intro
    • 97286f8 Improve example in readme
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    PR: unreviewed dependencies 
    opened by dependabot[bot] 1
  • React.JS Next.JS error importing private NPM library bumps into TypeError: _mui_styles_makeStyles__WEBPACK_IMPORTED_MODULE_12__ is not a function

    React.JS Next.JS error importing private NPM library bumps into TypeError: _mui_styles_makeStyles__WEBPACK_IMPORTED_MODULE_12__ is not a function

    Bug report

    I have a private NPM library using typescript exposed through index.js and hosted on private github packages. Importing it in my React.JS Next.JS application bumps into the following runtime error:

    error - unhandledRejection: TypeError: _mui_styles_makeStyles__WEBPACK_IMPORTED_MODULE_12__ is not a function
        at eval (webpack-internal:///../../node_modules/@myorg/mylib/build/index.js:106:21)
        at ../../node_modules/@myorg/gvs-kit/build/index.js (/apps/api/.next/server/pages/_app.js:11913:1)
        at __webpack_require__ (/apps/api/.next/server/webpack-runtime.js:33:42)
        at eval (webpack-internal:///./src/modules/MyModule/myFunction.ts:14:76)
        at ./src/modules/MyModule/myFunction.ts (/apps/api/.next/server/pages/_app.js:10303:1)
        at __webpack_require__ (/apps/api/.next/server/webpack-runtime.js:33:42)
        at eval (webpack-internal:///./src/auth/AuthProvider.tsx:13:85)
        at ./src/auth/AuthProvider.tsx (/apps/api/.next/server/pages/_app.js:10083:1)
        at __webpack_require__ (/apps/api/.next/server/webpack-runtime.js:33:42)
        at eval (webpack-internal:///./src/app/App.tsx:13:76)
        at ./src/app/App.tsx (/apps/api/.next/server/pages/_app.js:10017:1)
        at __webpack_require__ (/apps/api/.next/server/webpack-runtime.js:33:42)
        at eval (webpack-internal:///./src/app/Providers.tsx:24:63)
        at ./src/app/Providers.tsx (/apps/api/.next/server/pages/_app.js:10028:1)
        at __webpack_require__ (/apps/api/.next/server/webpack-runtime.js:33:42)
        at eval (webpack-internal:///./pages/_app.tsx:16:76)
        at ./pages/_app.tsx (/apps/api/.next/server/pages/_app.js:9984:1)
        at __webpack_require__ (/apps/api/.next/server/webpack-runtime.js:33:42)
        at __webpack_exec__ (/apps/api/.next/server/pages/_app.js:11934:39)
        at /apps/api/.next/server/pages/_app.js:11935:28
        at Object.<anonymous> (/apps/api/.next/server/pages/_app.js:11938:3)
        at Module._compile (node:internal/modules/cjs/loader:1119:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1173:10)
        at Module.load (node:internal/modules/cjs/loader:997:32)
        at Module._load (node:internal/modules/cjs/loader:838:12)
        at Module.require (node:internal/modules/cjs/loader:1021:19)
        at require (node:internal/modules/cjs/helpers:103:18)
        at Object.requirePage (/node_modules/next/dist/server/require.js:88:12)
        at /node_modules/next/dist/server/load-components.js:34:54
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async Promise.all (index 1)
        at async Object.loadComponents (/node_modules/next/dist/server/load-components.js:32:33)
        at async DevServer.findPageComponents (/node_modules/next/dist/server/next-server.js:561:36) {
      page: '/'
    }
    null
    

    Examining the exception line in .next/server/pages/_app.js shows the following:

    var _mui_styles_makeStyles__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @mui/styles/makeStyles */ \"../../node_modules/@myorg/mylib/node_modules/@mui/styles/node/makeStyles/index.js\");\n/* harmony import */ 
    

    What is the current behavior?

    If the current behavior is a bug, please provide the steps to reproduce.

    What is the expected behavior?

    Other relevant information: webpack version: 5 Node.js version: v18.8.0 Operating System: Ubuntu 22.10 Additional tools: next

    opened by khteh 0
  • chore(deps-dev): bump eslint-plugin-jest from 24.7.0 to 27.2.0

    chore(deps-dev): bump eslint-plugin-jest from 24.7.0 to 27.2.0

    Bumps eslint-plugin-jest from 24.7.0 to 27.2.0.

    Release notes

    Sourced from eslint-plugin-jest's releases.

    v27.2.0

    27.2.0 (2022-12-31)

    Features

    v27.1.7

    27.1.7 (2022-12-15)

    Bug Fixes

    v27.1.6

    27.1.6 (2022-11-24)

    Bug Fixes

    • ensure rule fixes produce valid code when function params and args have trailing commas (#1282) (8eca0b7)

    v27.1.5

    27.1.5 (2022-11-10)

    Performance Improvements

    • use Set instead of iterating, and deduplicate a function (#1278) (0e048f1)

    v27.1.4

    27.1.4 (2022-11-04)

    Performance Improvements

    • don't collect more info than needed when resolving jest functions (#1275) (e4a5674)

    v27.1.3

    27.1.3 (2022-10-18)

    Bug Fixes

    • no-restricted-jest-methods: don't crash on jest() (#1269) (4450daa)

    ... (truncated)

    Changelog

    Sourced from eslint-plugin-jest's changelog.

    27.2.0 (2022-12-31)

    Features

    27.1.7 (2022-12-15)

    Bug Fixes

    27.1.6 (2022-11-24)

    Bug Fixes

    • ensure rule fixes produce valid code when function params and args have trailing commas (#1282) (8eca0b7)

    27.1.5 (2022-11-10)

    Performance Improvements

    • use Set instead of iterating, and deduplicate a function (#1278) (0e048f1)

    27.1.4 (2022-11-04)

    Performance Improvements

    • don't collect more info than needed when resolving jest functions (#1275) (e4a5674)

    27.1.3 (2022-10-18)

    Bug Fixes

    • no-restricted-jest-methods: don't crash on jest() (#1269) (4450daa)

    27.1.2 (2022-10-14)

    Bug Fixes

    • valid-expect-in-promise: adjust grammar in rule message (#1264) (4494ed2)

    27.1.1 (2022-10-05)

    ... (truncated)

    Commits
    • b00b9b6 chore(release): 27.2.0 [skip ci]
    • ee43c3f feat: create require-typed-module-mocks rule (#1314)
    • 891fe1e chore(deps): update yarn to v3.3.1 (#1311)
    • fae0d2e chore: fix link in readme
    • 0958af4 chore(deps): lock file maintenance
    • 7fcf48f chore(deps): lock file maintenance
    • 42ce29f test(to-have-length): add optional chaining case (#1295)
    • 90f2d18 chore(release): 27.1.7 [skip ci]
    • 5d1b7a7 fix(prefer-spy-on): improve autofix (#1308)
    • f33b19e chore(deps): lock file maintenance
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    PR: unreviewed dependencies 
    opened by dependabot[bot] 1
Releases(v5.75.0)
  • v5.75.0(Nov 9, 2022)

    Bugfixes

    • experiments.* normalize to false when opt-out
    • avoid NaN%
    • show the correct error when using a conflicting chunk name in code
    • HMR code tests existance of window before trying to access it
    • fix eval-nosources-* actually exclude sources
    • fix race condition where no module is returned from processing module
    • fix position of standalong semicolon in runtime code

    Features

    • add support for @import to extenal CSS when using experimental CSS in node
    • add i64 support to the deprecated WASM implementation

    Developer Experience

    • expose EnableWasmLoadingPlugin
    • add more typings
    • generate getters instead of readonly properties in typings to allow overriding them
    Source code(tar.gz)
    Source code(zip)
  • v5.74.0(Jul 25, 2022)

    Features

    • add resolve.extensionAlias option which allows to alias extensions
      • This is useful when you are forced to add the .js extension to imports when the file really has a .ts extension (typescript + "type": "module")
    • add support for ES2022 features like static blocks
    • add Tree Shaking support for ProvidePlugin

    Bugfixes

    • fix persistent cache when some build dependencies are on a different windows drive
    • make order of evaluation of side-effect-free modules deterministic between concatenated and non-concatenated modules
    • remove left-over from debugging in TLA/async modules runtime code
    • remove unneeded extra 1s timestamp offset during watching when files are actually untouched
      • This sometimes caused an additional second build which are not really needed
    • fix shareScope option for ModuleFederationPlugin
    • set "use-credentials" also for same origin scripts

    Performance

    • Improve memory usage and performance of aggregating needed files/directories for watching
      • This affects rebuild performance

    Extensibility

    • export HarmonyImportDependency for plugins
    Source code(tar.gz)
    Source code(zip)
  • v5.73.0(Jun 2, 2022)

    Features

    • add options for default dynamicImportMode and prefetch and preload
    • add support for import { createRequire } from "module" in source code

    Bugfixes

    • fix code generation of e. g. return"field"in Module
    • fix performance of large JSON modules
    • fix performance of async modules evaluation

    Developer Experience

    • export PathData in typings
    • improve error messages with more details
    Source code(tar.gz)
    Source code(zip)
  • v5.72.1(May 10, 2022)

    Bugfixes

    • fix __webpack_nonce__ with HMR
    • fix in operator in some cases
    • fix json parsing error messages
    • fix module concatenation with using this.importModule
    • upgrade enhanced-resolve
    Source code(tar.gz)
    Source code(zip)
  • v5.72.0(Apr 7, 2022)

    Features

    • make cache warnings caused by build errors less verbose
    • Allow banner to be placed as a footer with the BannerPlugin
    • allow to concatenate asset modules

    Bugfixes

    • fix RemoteModules when using HMR (Module Federation + HMR)
    • throw error when using module concatenation and cacheUnaffected
    • fix in operator with nested exports
    Source code(tar.gz)
    Source code(zip)
  • v5.71.0(Apr 1, 2022)

    Features

    • choose smarter default for uniqueName when using a output.library which includes placeholders
    • add support for expressions with in of a imported binding
    • generate UMD code with arrow functions when possible

    Bugfixes

    • fix source map source names for ContextModule to be relative
    • fix chunkLoading option in module module
    • fix edge case where evaluateExpression returns null
    • retain optional chaining in imported bindings
    • include runtime code for the base URI even if not using chunk loading
    • don't throw errors in persistent caching when importing node.js builtin modules via ESM
    • fix crash when using lazy-once Context modules
    • improve handling of context modules with multiple contexts
    • fix race condition HMR chunk loading when importing chunks during HMR updating
    • handle errors in runAsChild callback
    Source code(tar.gz)
    Source code(zip)
  • v5.70.0(Mar 3, 2022)

    Features

    • update node.js version constraints for ESM support
    • add baseUri to entry options to configure a static base uri (the base of new URL())
    • alphabetically sort exports in namespace objects when possible
    • add __webpack_exports_info__.name.canMangle
    • add proxy support to experiments.buildHttp
    • import.meta.webpackContext as ESM alternative to require.context
    • handle multiple alternative directories (e. g. due to resolve.alias or resolve.modules) when creating an context module

    Bugfixes

    • fix problem when assigning global to a variable
    • fix crash when using experiments.outputModule and loaderContext.importModule with multiple chunks
    • avoid generating progress output before the compilation has started (ProgressPlugin)
    • fix handling of non-static-ESM dependencies with using TLA and HMR in the same module
    • include the asset module filename in hashing
    • output.clean will keep HMR assets for at least 10s to allow HMR to access them even when compilation is faster then the browser

    Performance

    • fix asset caching when using the BannerPlugin

    Developer Experience

    • improve typings

    Contributing

    • capture caching errors when running the test suite
    Source code(tar.gz)
    Source code(zip)
  • v5.69.1(Feb 17, 2022)

  • v5.69.0(Feb 15, 2022)

    Features

    • automatically switch to an ESM compatible environment when enabling ESM output mode
    • handle multiple alternative directories (e. g. due to resolve.alias or resolve.modules) when creating an context module
    • add util/types to node.js built-in modules
    • add __webpack_exports_info__.<name>.canMangle api

    Bugfixes

    • fix bug in chunk graph generation which leads to modules being included in chunk desprite them being already included in parent chunks
    • avoid writing more than 2GB at once during cache serialization (as workaround for node.js/libuv bug on MacOS)
    • fix handling of whitespaces in semver ranges when using Module Federation
    • avoid generating hashes which contain only numbers as they likely conflict with module ids
    • fix resource name based placeholders for data uris
    • fix cache serialization for context elements
    • fix passing of stage option when instrumenting plugins for the ProfilingPlugin
    • fix tracking of declarations in concatenated modules to avoid conflicts
    • fix unstable mangling of exports
    • fix handling of # in paths of loaders
    • avoid unnecessary cache update when using experiments.buildHttp

    Contributing

    • update typescript and jest

    Developer Experience

    • expose some additional typings for usage in webpack-cli
    Source code(tar.gz)
    Source code(zip)
  • v5.68.0(Jan 31, 2022)

    Features

    • allow to disable compile time evaluation of import.meta.url
    • add __webpack_module__ and __webpack_module__.id to the api

    Bugfixes

    • fix handling of errors thrown in async modules
    Source code(tar.gz)
    Source code(zip)
  • v5.67.0(Jan 21, 2022)

    Features

    • add 'outputPath' configuration option for resource asset modules
    • support Trusted Types in eval source maps
    • experiments.css
      • allow to generate only exports for css in node
      • add SyncModuleIdsPlugin to sync module ids between server and client compilation
      • add more options to the DeterministicModuleIdsPlugin to allow to generate equal ids

    Developer Experience

    • limit data url module name in stats printer
    • allow specific description for CLI options
    • improve space limiting algorithm in stats printing to show partial lists
    • add null to errors in callbacks
    • fix call signature types of addChunkInGroup

    Bugfixes

    • avoid reporting non-existant package.jsons as dependencies
    • experiments.css
      • fix missing css runtime when only initial css is used
      • fix css hmr support
      • bugfixes to css modules
    • fix cache serialization for CreateScriptUrlDependency
    • fix data url content when processed by a loader
    • fix regexp in identifiers that include |
    • fix ProfilingPlugin for watch scenarios
    • add layer to module names and identifiers
      • this avoid random module id changes when additional modules are added to another layer
    • provide hashFunction parameter to DependencyTemplates to allow customizing it there
    • fix HMR when experiments.lazyCompilation is enabled
    • store url as Buffer to avoid serialization warnings
    • exclude webpack-hot-middleware/client from lazy compilation

    Contributing

    • remove travis configuration
    • improve spell checking
    Source code(tar.gz)
    Source code(zip)
  • v5.66.0(Jan 12, 2022)

    Features

    • add output.library.type: "commonjs-static" to emit a statically analyse-able commonjs module (for node.js esm interop support)
    • add experiments.css (very experimental)
      • see https://github.com/webpack/webpack/issues/14893

    Bugfixes

    • fix CORS headers for experiments.lazyCompilation
    • fix [absolute-resource-path] for SourceMap module naming
    • avoid stack overflow when accessing many memory cached cache values in series

    Performance

    • reduce default watchOptions.aggregateTimeout to 20ms
    Source code(tar.gz)
    Source code(zip)
  • v5.65.0(Dec 6, 2021)

    Features

    • static evaluation understands undefined now
    • reduce container entry code by a few chars
    • use template literals when available and they make sense

    Bugfixes

    • handle singleton flag without requiredVersion in Module Federation
    • upgrade watchpack for context time info bugfix

    Performance

    • improve RegExp in error message formating for non-quadratic performance

    Developer Experience

    • automatically insert brackets when output.globalObject contains a non-trival expression
    • show error when using script type external with invalid syntax
    • expose types for Resolver, StatsOptions and ResolvePluginInstance

    Preparations for the future

    • hashDigestLength will default to 16 in webpack 6 (experiments.futureDefaults)
    Source code(tar.gz)
    Source code(zip)
  • v5.64.4(Nov 25, 2021)

    Bugfixes

    • fix tagged template literal evaluation
    • fix ModuleFederation with ESM
    • fix outputModule with intial splitChunks

    Performance

    • upgrade watchpack for faster watcher updating
    • track file and directory timestamps separately in watchpack and webpack

    Developer Experience

    • show origin of singleton shared module in mismatch warning
    Source code(tar.gz)
    Source code(zip)
  • v5.64.3(Nov 24, 2021)

    Performance

    • allow to use pre-compiled schema when Infinity is used in configuration
    • allow to use pre-compiled schema for configuration arrays
    Source code(tar.gz)
    Source code(zip)
  • v5.64.2(Nov 20, 2021)

  • v5.64.1(Nov 15, 2021)

    Bugfixes

    • fix regexp in managedPaths to exclude additional slash
    • make module.accept errorHandler optional in typings
    • correctly create an async chunk when using a require(...).property in require.ensure
    • fix cleaning of symlinks in output.clean: true
    • fix change detection with unsafeCache within managedPaths (node_modules)
    • bump webpack-sources for Stack Overflow bugfix
    Source code(tar.gz)
    Source code(zip)
  • v5.64.0(Nov 11, 2021)

    Features

    • add asyncChunks: boolean option to disable creation of async chunks

    Bugfixes

    • fix ProfilingPlugin for experiments.backCompat: false

    Performance

    • avoid running regexp twice over the file list
    Source code(tar.gz)
    Source code(zip)
  • v5.63.0(Nov 9, 2021)

  • v5.62.2(Nov 9, 2021)

    Bugfixes

    • fix __system_context__ injection when using the library option on entrypoint
    • enable exportsPresence: "error" by default in futureDefaults
    • fix bad performance for a RegExp in Stats printing (with large error messages)
    • fix exportPresence -> exportsPresence typo
    • fix a bug with module invalidation when only module id changes with experiments.cacheUnaffected
    Source code(tar.gz)
    Source code(zip)
  • v5.62.1(Nov 5, 2021)

  • v5.62.0(Nov 5, 2021)

    Features

    • add options to configure export presence checking
      • parser.javascript.reexportExportsPresence: false allows to disable warnings for non-existing exports during the migration from export ... from "..." to export type ... from "..." for type reexports in TypeScript
    • add experiments.backCompat: false to disable some expensive deprecations for better performance

    Bugfixes

    • use ['catch'] instead of .catch for better ES3 support
    • fix removed parentheses when using new (require("...")).Something()
    • fix { require } object literals
    • splitChunks.chunks option is now correctly used for splitChunks.fallbackCacheGroup.maxSize too
    • fix schema of listen option, allow to omit port
    • add better support for Promises from different isolates

    Developer Experience

    • add typings for the webpack API that is available within modules
      • use /// <reference types="webpack/module" /> to use the typings in typescript modules
      • or "types": [..., "webpack/module"] in tsconfig
    Source code(tar.gz)
    Source code(zip)
  • v5.61.0(Oct 29, 2021)

    Bugfixes

    • use a wasm md4 implementation for node 17 support
    • include the path submodules in the node.js default externals

    Performance

    • improve string to binary conversion performance for hashing

    Contribution

    • CI runs on node.js 17
    Source code(tar.gz)
    Source code(zip)
  • v5.60.0(Oct 25, 2021)

    Features

    • Allow to pass more options to experiments.lazyCompilation. e. g. port, https stuff

    Bugfixes

    • fix output.hashFunction used to persistent caching too
    • Initialize buildDependencies Set correctly when loaders are added in beforeLoaders hook
    Source code(tar.gz)
    Source code(zip)
  • v5.59.1(Oct 20, 2021)

  • v5.59.0(Oct 19, 2021)

    Features

    • add /*#__PURE__*/ for Object() in generated code
    • add RegExp and function support for managed/immutablePaths
    • add hooks for multiple phases in module build
    • improvements to experiments.buildHttp
      • allow to share cache
      • add allowlist
    • add splitChunks.minSizeReduction option

    Bugfixes

    • fix memory caching for Data URLs
    • fix crash in waitFor when modules are unsafe cached
    • fix bug in build cycle detection
    Source code(tar.gz)
    Source code(zip)
  • v5.58.2(Oct 13, 2021)

    Bugfixes

    • fix serialization context passed
    • fix a bug which caused module duplication when using persistent caching, unsafe cache and memory cache with GC
    • fix validation of snapshots of non-existing directories

    Performance

    • store a hash in first bits of bigint to workaround v8 hashing: https://github.com/v8/v8/blob/b704bc0958e2e26305a68e89d215af1aee011148/src/objects/bigint.h#L192-L195
    Source code(tar.gz)
    Source code(zip)
  • v5.58.1(Oct 8, 2021)

  • v5.58.0(Oct 7, 2021)

    Features

    • add hook for readResource
    • add diagnostics_channel to node builtins

    Performance

    • improve chunk graph creation performance
      • add cacheUnaffected cache support
    • remove some caching that makes not difference
    • improve splitChunks performance
    • improve chunk conditions performance
    Source code(tar.gz)
    Source code(zip)
  • v5.57.1(Oct 5, 2021)

Next-generation ES module bundler

Rollup Overview Rollup is a module bundler for JavaScript which compiles small pieces of code into something larger and more complex, such as a librar

Rollup 22.7k Jan 4, 2023
A blazing fast js bundler/loader with a comprehensive API :fire:

A bundler that does it right FuseBox on slack FUSEBOX v4 is out! Install: npm install fuse-box --save-dev import { fusebox } from 'fuse-box'; fusebox

null 4k Jan 7, 2023
Creates ES6 ./index.js file in target directories that imports and exports all sibling files and directories.

create-index create-index program creates (and maintains) ES6 ./index.js file in target directories that imports and exports sibling files and directo

Gajus Kuizinas 270 Nov 25, 2022
Package your Node.js project into an executable

Disclaimer: pkg was created for use within containers and is not intended for use in serverless environments. For those using Vercel, this means that

Vercel 22.6k Jan 7, 2023
This template is designed for compiling Rust libraries into WebAssembly and publishing the resulting package to NPM.

This template is designed for compiling Rust libraries into WebAssembly and publishing the resulting package to NPM.

Keith 2 Jul 5, 2022
Build node packages into deployable applications

strong-build Build a node application package, preparing it for deploy to production. It is useful standalone, but is commonly used to build applicati

StrongLoop and IBM API Connect 47 Mar 3, 2022
This is a Webpack Project about Todo-list which you can add your to-dos, edit them, add mark as completed.

Todo-list-webpack This website Todo-list-webpack provides users a convenient way to keep track of their todos. Built With HTML CSS JavaScript Linters

Omar Salem 16 Jul 14, 2022
A toolkit to automate & enhance your workflow

The streaming build system What is gulp? Automation - gulp is a toolkit that helps you automate painful or time-consuming tasks in your development wo

gulp 32.7k Jan 6, 2023
A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript.

InversifyJS A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript. About InversifyJS is a ligh

inversify 9.5k Jan 4, 2023
Grunt: The JavaScript Task Runner

Grunt: The JavaScript Task Runner Documentation Visit the gruntjs.com website for all the things. Support / Contributing Before you make an issue, ple

grunt 12.2k Dec 31, 2022
Builder: A gulp-like build system with modern JavaScript

Builder: A gulp-like build system with modern JavaScript What is this? This is a build system meant to automate tasks. At this point it’s merely a con

Wladimir Palant 7 Mar 22, 2022
Task toolkit. For when `npm run` isn't enough and everything else is too much.

For when npm run isn't enough and everything else is too much. Ygor is a no-frills toolkit consisting of a task runner and a file transformer. Enjoy a

Shannon Moeller 68 Nov 12, 2022
Simple build system and CLI for AMX Mod X projects

?? AMXXPack Simple build system and CLI for AMX Mod X projects. ?? About This system will be useful for projects with multiple plugins and assets. Usi

Hedgehog Fog 11 Nov 15, 2022
curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.

curl (cujoJS resource loader) All development for curl.js and cram.js has stopped. For the foreseeable future, we will continue to respond to issues o

The Javascript Architectural Toolkit 1.9k Dec 30, 2022
A tool helps to generate ttf, woff, woff2 and css file at the same time. Supports splitting font files on demand

Font Pack A tool helps to generate ttf, woff, woff2 and css file at the same time. Supports splitting font files on demand. 一个可以根据常用字体格式文件,直接生成 ttf、wo

GyDi 2 Apr 18, 2022
This project is a Web application based on an external API. The API provides data about music (including artists, albums, etc) that users can access on-demand. This project was built with ES6, HTML and CSS and it is a SPA.

Capstone M2: Music App This project is a Web application based on the music API Napster built with ES6, HTML and CSS and it is a SPA. This API provide

Karla Delgado 12 Aug 29, 2022
The awesomebooks project is a simple list, but separated into 3 parts and given a retro feel. The main page is where we can add books, and on another page we can see the list, and remove items. There is also a "contact-us" page.

Awesome Books This is the restructured version of the famous awesome-books project! Here you can find JavaScript broken into modules, using import-exp

Matt Gombos 12 Nov 15, 2022