Skip to content

Bug: mid never defined when passing amd {request} to externals callback in v3 #6302

@mwistrand

Description

@mwistrand

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

Report a bug.

What is the current behavior?

Using webpack 3.10.0, when specifying the type as "amd" from within an externals function in the configuration, a module that exports __WEBPACK_EXTERNAL_MODULE_{id}__ is defined, but that constant is not included in the UMD wrapper arguments.

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

webpack config
build output

The only module being bundled is the following src/main.js:

console.log(require('some/amd/dep'));

When viewing in the browser, the error message Uncaught ReferenceError: __WEBPACK_EXTERNAL_MODULE_1__ is not defined is logged to the console. If the amd type is excluded from the string passed to the externals callback, then 'some/amd/dep' is correctly passed in through define/require calls in the UMD wrapper. However, my guess is that specifying the amd type explicitly is supposed to work as well like it does in version 2.

What is the expected behavior?

The AMD module would be injected to the AMD define in the UMD wrapper, with the __WEBPACK_EXTERNAL_MODULE_{id}__ included as one of the wrapper's arguments.

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.

  • Webpack 3.10.0
  • Node.js 8.9.1
  • npm 5.5.1
  • Chrome 63.0
  • macOS High Sierra 10.13.2

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