Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Misleading documentation on externals type or potential bug #4148

Copy link
Copy link
Closed
@dmitrysteblyuk

Description

@dmitrysteblyuk
Issue body actions

The documentation makes us believe that this example:

module.exports = {
  //...
  externals: {
    jquery: 'jQuery'
  }
};

will result in jquery imports to be replaced with jQuery variable:

In other words, when a string is provided it will be treated as root (defined above and below).
root: The library should be available as a global variable (e.g. via a script tag).

However it's not exactly true.
The default type of externals is defined by externalsType option. Which is by default defined as follows:

https://github.com/webpack/webpack/blob/master/lib/config/defaults.js#L189-L198

So for example in case of commonjs library target import $ from 'jquery'; will be transformed to require("jQuery").

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.