-
hash和chunkhash的区别 hash:是每次打包的hash chunkhash: 每个模块自己的hash值,可以理解为版本号,也理解为md5值(保证每个文件的唯一性)查看全部
-
name + hash查看全部
-
模板引擎查看全部
-
npm 的script 命令。查看全部
-
最简单的webpack打包,通过配置文件(前几分钟开始)查看全部
-
自定义脚本命令: package.json 下 配置scripts属性 例: "webpack": "webpack --config webpack.config.js --progress --colors" 在命令行中执行 npm run webpack 即可看到效果 默认配置文件名:webpack.config.js 文件样式: module.exports = { //,,, }查看全部
-
自定义脚本命令: package.json 下 配置scripts属性 例: "webpack": "webpack --config webpack.config.js --progress --display-moudles --colors --display-reasons" 在命令行中执行 npm run webpack 即可看到效果查看全部
-
css-laoder 用于处理.css文件 style-loader 用于将处理完的文件新建一个style标签插入到html里查看全部
-
@import非less中引入样式文件处理查看全部
-
引入postcss插件查看全部
-
提高打包速度查看全部
-
利用html-webpack-plugin插件实现引入文件md5改变时自动改变查看全部
-
var htmlWebpackPlugin = require('html-webpack-plugin') module.exports = { entry: { main: './src/js/main.js', a: './src/js/a.js', b: './src/js/b.js', c: './src/js/c.js' }, output: { path: './dist', filename: 'js/[name]-[chunkhash].js', publicPath: 'http://cdn.com/' }, plugins:[ new htmlWebpackPlugin({ filename: 'a.html', template: './index.html', inject: 'body', title: "webpack is good", chunks: ['main', 'a'] }), new htmlWebpackPlugin({ filename: 'b.html', template: './index.html', inject: "body", title: "this is b.html", chunks: ['b'] }), new htmlWebpackPlugin({ filename: 'c.html', template: './index.html', inject: "body", title: "this is c.html", chunks: ['c'] }) ] }查看全部
-
var htmlWebpackPlugin = require('html-webpack-plugin') module.exports = { entry: { hello: './src/js/hello.js', world: './src/js/world.js' }, output: { path: './dist', filename: 'js/[name]-[hash].js', publicPath: 'http://cdn.com/' }, plugins:[ new htmlWebpackPlugin({ filename: 'index.html', template: './index.html', inject: false, title: "webpack is good", date: new Date(), minify: { removeComments: true, collapswWhitespace:true } }) ] }查看全部
-
```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title><%= htmlWebpackPlugin.options.title %></title> <script type="text/javascript" src="<%= htmlWebpackPlugin.files.chunks.main.entry %>"> </script> <script type="text/javascript" src="<%= htmlWebpackPlugin.files.chunks.a.entry %>"> </script> </head> <body> <%= htmlWebpackPlugin.options.date%> <!--<% for(var key in htmlWebpackPlugin.files){%> <%= key%> : <%= JSON.stringify(htmlWebpackPlugin.files[key])%> <%}%> <% for(var key in htmlWebpackPlugin.options){%> <%= key%> : <%= JSON.stringify(htmlWebpackPlugin.options[key])%> <%}%>--> </body> </html> ```查看全部
举报
0/150
提交
取消