webpack 2.3.2 and external AMD Modules

Bug report – external AMD modules don’t load webpack 2.3.2

Current behavior
I have an external amd module mylogger, I load into my pages using requirejs.

I’ve added externals to my webpack config:

    externals: {
        mylogger: true, // b is external (require("b"))

when I try to use the module in my code:

Cannot find module "mylogger" at webpackMissingModule

the module is defined as this:

define("mylogger", [], function () {  ...

it’s included in my page via require js config

    baseUrl: '/Applications/',
    paths: {
        'mylogger': 'mylogger'

Other notes:
a test in the page confirms the module loads correctly (when not using webpack)

require(["mylogger"], function (mylogger) { console.log('mylogger loaded'); });
prints 'mylogger loaded'

Expected behavior
The module loads correctly (e.g no errors) when called (from code within a webpack bundle)

import mylogger= require("mylogger");   //typescript

which roughly translates to

var mylogger = _webpack_require("mylogger")

If this is a feature request, what is motivation or use case for changing the behavior?
I consider this a bug.

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
I’m working with Windows 2012 r2, node 7.5, webpack 2.2

Author: Fantashit

1 thought on “webpack 2.3.2 and external AMD Modules

Comments are closed.