33 英文官网:https://webpack.js.org/
44 其他中文网:https://webpack.docschina.org/
55*/
6+ const path = require ( 'path' ) ;
67const webpack = require ( 'webpack' ) ;
78// html-webpack-plugin:https://www.webpackjs.com/plugins/html-webpack-plugin/
89const HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
@@ -22,8 +23,6 @@ const tsImportPluginFactory = require('ts-import-plugin');
2223// 生成包含构建hash的json文件:SPA会定期把初始 hash 和远程的 hash 相比较,并在不匹配的时候重新加载。
2324const BuildHashPlugin = require ( 'build-hash-webpack-plugin' ) ;
2425
25- const path = require ( 'path' ) ;
26-
2726const prodMode = process . env . NODE_ENV === 'production' ;
2827const resolvePath = ( dir ) => path . join ( __dirname , '..' , dir ) ;
2928// https://cdn.baomitu.com
@@ -246,12 +245,12 @@ module.exports = {
246245 // 路径别名
247246 alias : {
248247 '@' : resolvePath ( 'src' ) ,
249- '@constant' : resolvePath ( 'src/constant' ) ,
250- '@components' : resolvePath ( 'src/components' ) ,
251- '@api' : resolvePath ( 'src/api' ) ,
252- '@utils' : resolvePath ( 'src/utils' ) ,
253- '@css' : resolvePath ( 'src/assets/css' ) ,
254- '@img' : resolvePath ( 'src/assets/img' ) ,
248+ '@/ constant' : resolvePath ( 'src/constant' ) ,
249+ '@/ components' : resolvePath ( 'src/components' ) ,
250+ '@/ api' : resolvePath ( 'src/api' ) ,
251+ '@/ utils' : resolvePath ( 'src/utils' ) ,
252+ '@/ css' : resolvePath ( 'src/assets/css' ) ,
253+ '@/ img' : resolvePath ( 'src/assets/img' ) ,
255254 } ,
256255 } ,
257256 optimization : {
0 commit comments