Webpack alias resolution - not working
Hi there
What are the constraints around webpack module alias resolution? Mine are not being recognised by Webstorm's problem checking (it runs fine) and I don't know why.
My webpack config file (specified in Preferences-> Languages & Frameworks -> Javascript -> Webpack) appears to be getting parsed properly because i'm not getting the usual error message when it cannot.
the file specifies aliases in the usual way:
module.exports = ...
module.exports = ...
resolve: {
alias: {
AnAlias: path.resolve(__dirname, './somepath'),
However I am defining the module.exports as a function with args (maybe it can't parse this?) as in here:
module.exports = (env, argv) => {
Anyway, with this configuration webstorm can't resolve imports:
import SomeFile from 'AnAlias/somefile.js';
Any ideas? I'm pretty sure this used to work but I don't know when it stopped working.
Thanks vm in advance
Please sign in to leave a comment.
>However I am defining the module.exports as a function with args (maybe it can't parse this?)
this must be the issue; when webpack configuration file is evaluated, no arguments are passed in, so you have to control the existance of
env
andargv
in your webpack configuration function (see https://youtrack.jetbrains.com/issue/WEB-36182#focus=Comments-27-3474242.0-0, for example)