webpack
辣鸡王八鸭
励志在这条路上越走越远
展开
-
webpack打包遇到的那些坑
1. src 下的index.js中图片的加载 import img1 from ‘./img/caomei.jpg’ import img2 from ‘./img/huahua.jpg’ var img = new Image(); img.src = img2; document.body.appendChild(img); var img3 = new Image(); img3.src...原创 2020-02-26 17:53:21 · 475 阅读 · 0 评论 -
ERROR in ./src/style.css Module build failed: CssSyntaxError (1:1) Unknown word
打包css遇到 ERROR in ./src/style.css Module build failed: CssSyntaxError (1:1) Unknown word 一脸懵逼 以前没错啊 可能之前都是复制的 解决方案 { test: /.css$/, use: [ ...原创 2020-03-08 14:42:51 · 3541 阅读 · 1 评论 -
webpack学习extract-text-webpack-plugin 单独打包css
webpack单独打包css 1.首先安装extract-text-webpack-plugin 2.在webpack.config.js里面引入 const ExtractPlugin = require(‘extract-text-webpack-plugin’) 3.配置 plugins: [ new HtmlWebpackPlugin( { title:‘ToDo’ //自动生成的...原创 2020-03-10 15:23:52 · 394 阅读 · 0 评论 -
webpack区分打包类库代码及hash优化
利用浏览器的缓存机制,减少服务器压力,合理使用缓存 使用new webpack.optimize.CommonsChunkPlugin时报错:Error: webpack.optimize.CommonsChunkPlugin has been removed, please use config.optimization.splitChunks instead. 解决方案 config.opti...原创 2020-03-10 17:26:32 · 319 阅读 · 0 评论