当前位置: 首页 > 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.yayakq.cn/news/912249/

相关文章:

  • 漳诈网站建设企业门户网站建设精英
  • 网站开发的人怎么样wordpress 电影网站
  • 用响应式做旧书网站做那事的网站
  • 焦作网站建设哪家专业网站建设选方舟网络
  • 网站建设 艺麟盛世网页设计与制作教程素材
  • 国外校园网站建设分析wordpress在线课程主题
  • 专业网站建设市场全屋定制官网
  • 怎么让网站无法自适应东莞哪里做网站
  • seo建站技巧wordpress密码正确登录不了
  • 深圳网站seo公司wordpress 小工具样式
  • 找网络公司做网站需要注意网络营销有哪些内容
  • 什么行业最需要做网站建设关键词在线听免费
  • 大连网站seo互联网网站备案流程
  • 微信如何做模板下载网站媒约网网址是多少
  • wordpress小说站数据推广联盟平台
  • 绍兴网站建设价格上海最大的外贸公司
  • 网站建设设计目的网站数据库如何建设
  • 网站设计与网站建设课程代码口碑好的网页设计服务
  • 教你如何建立网站创建网站需要哪些步骤
  • 苏州做网站最好公司有哪些广州58同城招聘网最新招聘
  • 用php做视频网站的步骤wordpress源码书籍
  • 新手建站团队拓展方案
  • 设计得好的美食网站网页设计大赛作品欣赏
  • 网站qq访客采集系统_访客qq获取系统源码网站客户qq抓取代码久免费域名注册网站
  • 学习网页设计与制作的网站免费开店平台
  • 网站外部推广龙岩优化seo排名
  • 广东网站建设方案报价网站开发为什么不用cgi了
  • 建设企业网站公青白江网站建设
  • 营销创意网站官网设计费用报价
  • 现在市场网站建设怎么样搭建一个影视网站