Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Attempting to create an alias for multiple paths. Using the following configuration:
const path = require('path');
const resolve = file => path.resolve(__dirname, file);
module.exports = {
entry: './src/main.js',
output: {
filename: 'bundle.js'
},
resolve: {
alias: [{
alias: 'controllers',
name: resolve('src/controllers')
}, {
alias: 'controllers',
name: resolve('src/dbo')
}]
}
}
Requiring a module in controllers
from the entry file works, but requiring a module in controllers
from a module that is in a controller throws this error.
ERROR in ./src/main.js
Module not found: Error: Can't resolve 'controllers/UserController' in '/Users/mjanjic/Desktop/webpack-test/src'
@ ./src/main.js 1:23-60
The resolve.alias documentation specifies initialization only via object.
If the current behavior is a bug, please provide the steps to reproduce.
Exact example available in reproducible repo here
What is the expected behavior?
Webpack build should pass.
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.
npm: 4.2.0
node: v7.10.0
webpack: v3.3.0
OSX: 10.12.5
sorry for reviving a closed issue, but is this functionality can be achieved somehow in the current plugin system?
i have lots of
I want webpack to search for
desktop/src/util/ajax
first, if it’s not exists, resolve tocommon/src/util/ajax
. i know i might get a better chance with suffix and resolve extensions, but i want to know if this is possible first before go on moving and renaming lots of files..