resolve: { extensions: ['.js', '.jsx','.ts','.tsx', '.scss','.json','.css'], alias: { 'vue$': 'vue/dist/vue.esm.js', "@": path.resolve(__dirname, 'src'), "components": path.resolve(__dirname, '/src/components'), "utils": path.resolve(__dirname + '/src/utils'), }, modules: ['node_modules'] }
16.支持sass
输入命令下载sass-loader node-sass
npm i sass-loader node-sass -D
修改webpack.config.js的css
{ test: /\.sass$/, use:['vue-style-loader', 'css-loader', 'sass-loader' ], include: path.resolve(__dirname + '/src/'), exclude: /node_modules/ },
基本也配置个差不多了,还需要补充一些东西,以后会加上。
这一篇算是webpack构建vue项目基础吧,下一篇会再次补充并深入,谢谢大家,希望大家能多提意见,一起在码农的道路上越走越远
感恩骗点star项目地址 https://github.com/mr-mengbo/webpackconfig