The current docs have a warning:
IMPORTANT: Setting this option will override the default, meaning that webpack will no longer try to resolve modules using the default extensions. If you want modules that were required with their extension (e.g. require('./somefile.ext')) to be properly resolved, you must include an empty string in your array. Similarly, if you want modules that were required without extensions (e.g. require('underscore')) to be resolved to files with “.js” extensions, you must include ".js" in your array.
The middle part about the empty string is also required for regular node_modules imports, without the ./ prefix. I didn't have any imports with the full extension, I had my extensions labelled correctly otherwise in webpack.config.js (i.e.: extensions: ['.js', '.jsx']), and webpack kept complaining that it couldn't find any of my modules. Adding '' to the list solved the problem, but it took me a full day to figure this out, perhaps it should be explicitly mentioned in the docs so others don't make the same silly mistake?
Even better, if webpack comes across a require without a path prefix, it should default to looking for a node_modules module without considering any extensions.
Thanks.
The current docs have a warning:
The middle part about the empty string is also required for regular node_modules imports, without the
./prefix. I didn't have any imports with the full extension, I had my extensions labelled correctly otherwise inwebpack.config.js(i.e.:extensions: ['.js', '.jsx']), and webpack kept complaining that it couldn't find any of my modules. Adding''to the list solved the problem, but it took me a full day to figure this out, perhaps it should be explicitly mentioned in the docs so others don't make the same silly mistake?Even better, if webpack comes across a require without a path prefix, it should default to looking for a node_modules module without considering any extensions.
Thanks.