feat: Webpack 路径别名优化
This commit is contained in:
@@ -107,11 +107,28 @@ module.exports = {
|
||||
...webpackConfig.resolve,
|
||||
alias: {
|
||||
...webpackConfig.resolve.alias,
|
||||
// 根目录别名
|
||||
'@': path.resolve(__dirname, 'src'),
|
||||
'@components': path.resolve(__dirname, 'src/components'),
|
||||
'@views': path.resolve(__dirname, 'src/views'),
|
||||
|
||||
// 功能模块别名(按字母顺序)
|
||||
'@assets': path.resolve(__dirname, 'src/assets'),
|
||||
'@components': path.resolve(__dirname, 'src/components'),
|
||||
'@constants': path.resolve(__dirname, 'src/constants'),
|
||||
'@contexts': path.resolve(__dirname, 'src/contexts'),
|
||||
'@data': path.resolve(__dirname, 'src/data'),
|
||||
'@hooks': path.resolve(__dirname, 'src/hooks'),
|
||||
'@layouts': path.resolve(__dirname, 'src/layouts'),
|
||||
'@lib': path.resolve(__dirname, 'src/lib'),
|
||||
'@mocks': path.resolve(__dirname, 'src/mocks'),
|
||||
'@providers': path.resolve(__dirname, 'src/providers'),
|
||||
'@routes': path.resolve(__dirname, 'src/routes'),
|
||||
'@services': path.resolve(__dirname, 'src/services'),
|
||||
'@store': path.resolve(__dirname, 'src/store'),
|
||||
'@styles': path.resolve(__dirname, 'src/styles'),
|
||||
'@theme': path.resolve(__dirname, 'src/theme'),
|
||||
'@utils': path.resolve(__dirname, 'src/utils'),
|
||||
'@variables': path.resolve(__dirname, 'src/variables'),
|
||||
'@views': path.resolve(__dirname, 'src/views'),
|
||||
},
|
||||
// 减少文件扩展名搜索
|
||||
extensions: ['.js', '.jsx', '.json'],
|
||||
|
||||
Reference in New Issue
Block a user