webpack02
consumer-index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Consumer</title>
</head>
<body>
<h1>Consumer Page</h1>
<p id="content"></p>
<script src="/dist/consumer.bundle.js"></script>
</body>
</html>
consumer-index.js
document.getElementById('content').innerText = 'This is Consumer page';
admin-index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Admin</title>
</head>
<body>
<h1>Admin Page</h1>
<p id="content"></p>
<script src="/dist/admin.bundle.js"></script>
</body>
</html>
admin-index.js
document.getElementById('content').innerText = 'This is Admin page';
webpack.config.js
var path = require('path');//自带标准库
var config = {
entry: {
admin: './admin/index.js', //2个入口
consumer: './consumer/index.js' //2个入口
},
output: {
path: path.join(__dirname, 'dist'), //dist放打包出来的文件
publicPath: '/dist/', //webpack自带的测试环境server
filename: '[name].bundle.js'
}
};
module.exports = config;
package.json
{
"name": "demo2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack-dev-server --progress --colors --hot --inline",//启动开发环境需要的东西
"build": "webpack --progress --colors -p"
},
"author": "",
"license": "ISC",
"devDependencies": {
"node-argv": "0.0.7",
"webpack": "1.12.1",
"webpack-dev-server": "1.10.1"
}
}
webpack02的更多相关文章
随机推荐
- json转换成Map
1.如果转换的是Map.或者是简单的对象 package com.gc.action; import java.util.Map; import net.sf.json.JSONObject; /** ...
- POJ 2311 Cutting Game(SG函数)
题目描述 意思就是说两个人轮流剪纸片,直到有一个人剪出1*1的方格就算这个人赢了.然后给出纸片的长和宽,求先手会赢还是会输 (1<=n,m<=200) 题解 看了一眼,这不是裸的SG吗 啪 ...
- @GetMapping、@PostMapping、@PutMapping、@DeleteMapping、@PatchMapping
@GetMapping.@PostMapping.@PutMapping.@DeleteMapping.@PatchMapping @GetMapping是一个组合注解,是@RequestMappi ...
- Eclipse配置class文件输出目录
1, Eclipse选中项目名称,邮件选中“Build Path”,然后选择“Configure Build Path”--->选择“Source” Tab---->修改"Def ...
- GenIcam标准(一)
1.概述 如今的数码摄相机包含了很多的功能,而不仅仅是采集图像.对于机器视觉相机来说,处理图像并把结果附加到图像数据流上,控制附加的硬件,代替应用程序作实时的处理等都是很平常的事情.这也导致了相机的编 ...
- HDU 3415 Max Sum of Max-K-sub-sequence 单调队列题解
本题又是一题单调队列题解. 技巧就是须要计算好前n项和Sn = a1 + a2 + ... an 这样方便处理. 记录一条单调队列,其意义是: q(head), q(head+1), ...q(tai ...
- nginx和apache作为webserver的差别
1.两者所用的驱动模式不同. nginx使用的是epoll的非堵塞模式事件驱动. apache使用的是select的堵塞模式事件驱动. 2.fastcgi和cgi的差别 当用户请求web服务的时候.w ...
- [TypeScript] Asynchronous Iteration using for-await-of
The for-await-of syntax is similar to the for-of iteration. The key difference is that it automatica ...
- 部署zookeeper实践
1.解压zookeeper 2.环境变量设置 hadoop@namenode:~/zookeeper-3.4.6/conf$ sudo vim /etc/profile export JAVA_HOM ...
- SPOJ1812: LCS2 - Longest Common Substring II & BZOJ2946: [Poi2000]公共串
[传送门:SPOJ1811&BZOJ2946] 简要题意: 给出若干个字符串,求出这些字符串的最长公共子串 题解: 后缀自动机 这两道题的区别只是在于一道给出了字符串个数,一个没给,不过也差不 ...