当前位置: 首页 > news >正文

自助网站建设哪家优惠中国搜索引擎

自助网站建设哪家优惠,中国搜索引擎,网站建设网站,太原网站建设制作1.module,chunk,bundle的区别 moudle - 各个源码文件,webpack中一切皆是模块chunk - 多模块合并成的,如entry, import(), splitChunkbundle - 最终的输出文件 2.多文件打包配置 2.1 webpack.common.js const path require(path) const HtmlWebpackPl…

1.module,chunk,bundle的区别

  • moudle - 各个源码文件,webpack中一切皆是模块
  • chunk - 多模块合并成的,如entry, import(), splitChunk
  • bundle - 最终的输出文件

2.多文件打包配置

2.1 webpack.common.js

const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { srcPath, distPath } = require('./paths')module.exports = {entry: {index: path.join(srcPath, 'index.js'),other: path.join(srcPath, 'other.js')},module: {rules: [// ----- 同上文 ----]},plugins: [// 多入口 - 生成 index.htmlnew HtmlWebpackPlugin({template: path.join(srcPath, 'index.html'),filename: 'index.html',// chunks 表示该页面要引用哪些 chunk (即上面的 index 和 other),默认全部引用// chunks: ['index']  // 只引用 index.js}),// 多入口 - 生成 other.htmlnew HtmlWebpackPlugin({template: path.join(srcPath, 'other.html'),filename: 'other.html',// chunks: ['other']  // 只引用 other.js})]
}
  • 上面的chunks配置,如果不配置chunks,那么打包出来的结果是默认引入全部js
<body><p>webpack demo</p><input type="text"/><script type="text/javascript" src="index.js"></script><script type="text/javascript" src="other.js"></script>
</body>
  • 如果配置了chunks,那么就只引入对应的结果
<body><p>webpack demo</p><input type="text"/><script type="text/javascript" src="index.js"></script>
</body>
2.2 webpack.prod.js
const path = require('path')
const webpack = require('webpack')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const webpackCommonConf = require('./webpack.common.js')
const { smart } = require('webpack-merge')
const { srcPath, distPath } = require('./paths')module.exports = smart(webpackCommonConf, {mode: 'production',output: {// filename: 'bundle.[contentHash:8].js',  // 打包代码时,加上 hash 戳filename: '[name].[contentHash:8].js', // name 即多入口时 entry 的 keypath: distPath,// publicPath: 'http://cdn.abc.com'  // 修改所有静态文件 url 的前缀(如 cdn 域名),这里暂时用不到},module: {rules: [//代码重复]},plugins: [new CleanWebpackPlugin(), // 会默认清空 output.path 文件夹new webpack.DefinePlugin({// window.ENV = 'production'ENV: JSON.stringify('production')})]
})
  • 多入口时,output出口的【name】变量会对应到入口的变量名
http://www.hrbkazy.com/news/48877.html

相关文章:

  • 中国住房建设部网站首页云优化seo
  • 江西响应式网页建设湖南靠谱的关键词优化
  • 西安做网站选哪家好seo优化技术排名
  • 企业网站开发创意热搜榜排名今日事件
  • 做网站 空间还是服务器竞价托管公司联系方式
  • 遵义制作网站免费网络营销方式
  • 便宜的做网站公司免费产品推广软件
  • 网络架构师主要做什么郑州seo顾问外包公司
  • 网站备案 公司注销吗人民日报今日新闻
  • 滕州做网站企业网站建设流程
  • 如何建立网站或网页沈阳今天刚刚发生的新闻
  • 网页显示站点不安全杭州网站搜索排名
  • 网站建设注册密码咋弄青岛seo建站
  • wordpress 主查询seo有哪些优缺点?
  • 哈尔滨如何做网站推广优化2022最近十大的新闻热点
  • 北京 企业网站开发今日头条新闻最新事件
  • asp动态网站衣服销售微信软文范例100字
  • 爱媛直播seo短视频入口引流
  • 公司网站需要程序员做吗海口seo计费
  • 全球最受欢迎的网站免费二级域名查询网站
  • 上海建设单位工程备案网站百度推广和优化有什么区别
  • 济南营销型网站建设公司营销型网站建设优化建站
  • 齐河做网站百度怎么提交收录
  • 深圳做手机网站多少钱百度今日数据
  • 十大不封号直播平台企业网站seo多少钱
  • wordpress $limit移动端seo关键词优化
  • 企业做网站要注意些什么问题上海网络推广渠道
  • 济宁网站开发招聘域名信息查询网站
  • 专门做淘宝收藏可以赚钱的网站公众号如何推广运营
  • 合肥网站建设找佳达长春网站制作公司