Description
I've been seeing a problem for several months now (about the time I upgraded to the most recent webpack) where an import statement will yield a correct value in an incremental build, but will produce an undefined value in a full build.
Example:
import React from 'react';
import classNames from 'classnames';
import { withRouter } from 'react-router'; // 'withRouter' is undefined
What's interesting is that the bug only occurs in the initial build. If I touch any source file and refresh the page, the code works properly.
Unfortunately, I cannot produce a small example that reproduces the problem, because it only seems to affect one import out of several thousand in a large proprietary code base.
I don't expect anyone to be able to figure out the problem given the limited details I am able to offer; what I would like is advice on how to dive deeper and diagnose what's going wrong. For example, I thought if there was a way I could disable tree-shaking, or turn off module support and revert back to babel modules, that would at least eliminate one possibility. (I opened a question on SO, but no responses so far).
My babel configuration is fairly simple:
babel_plugins = [
'transform-object-rest-spread',
'react-hot-loader/babel',
];
babel_presets = ['react', ['env', { modules: false, targets: { browsers: 'last 2 versions' } }]];
My current version of webpack is 2.3.3 and webpack-dev-server is 2.4.2. My OS is Mac OS 10.11.6.