const {resolve} = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin') module.exports = {
entry:'./src/index.js',
output:{
filename:'built.js',
path:resolve(__dirname,'build')
},
module:{
rules:[
{
test:/\.css$/,
use:['style-loader','css-loader']
},
// 打包其他资源(除了html/js/css资源以外的资源)
{
//排除css/js/html资源
exclude:/\.(html|css|js|less)$/,
loader:'file-loader',
options: {
name:'[hash:10].[ext]'
}
}
]
},
plugins:[
new HtmlWebpackPlugin({
template:resolve(__dirname,'src/index.html')
})
], // 开发服务器 devServer:用来自动化(自动编译,自动打开浏览器,自动刷新浏览器~~)
// 特点:只会在内存中编译打包,不会有任何输出
// 启动devServer指令为:npx webpack-dev-server
mode:'development',
devServer:{
// 项目构建后路径
contentBase: resolve(__dirname, 'build'),
// 启动gzip压缩
compress: true,
// 端口号
port: 3000,
// 自动打开浏览器
open: true
}
}

!!! webpack5 有版本兼容问题

09-devserver的更多相关文章

  1. Windows7WithSP1/TeamFoundationServer2012update4/SQLServer2012

    [Info   @09:03:33.737] ====================================================================[Info   @ ...

  2. 《HelloGitHub月刊》第09期

    <HelloGitHub>第09期 兴趣是最好的老师,<HelloGitHub>就是帮你找到兴趣! 前言 转眼就到年底了,月刊做到了第09期,感谢大家一路的支持和帮助

  3. js正则表达式校验非零的正整数:^[1-9]\d*$ 或 ^([1-9][0-9]*){1,3}$ 或 ^\+?[1-9][0-9]*$

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  4. iOS系列 基础篇 09 开关、滑块和分段控件

    iOS系列 基础篇 09 开关.滑块和分段控件 目录: 案例说明 开关控件Switch 滑块控件Slider 分段控件Segmented Control 1. 案例说明 开关控件(Switch).滑块 ...

  5. http://www.cnblogs.com/Lawson/archive/2012/09/03/2669122.html

    http://www.cnblogs.com/Lawson/archive/2012/09/03/2669122.html

  6. C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0

    C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0

  7. u-boot-2010.09移植(A)

    第一阶段 1.开发环境 系统:centOS6.5           linux版本:2.6.32         交叉编译器:buildroot-2012.08 以上工具已经准备好,具体安装步骤不再 ...

  8. u-boot-2010.09移植(B)

    前面我们的u-boot只是在内存中运行,要想在nandflash中运行,以达到开机自启的目的,还需作如下修改 一.添加DM9000网卡支持 1.修改board/fl2440/fl2440.c中的boa ...

  9. Linux JDK 安装及卸载 http://www.cnblogs.com/benio/archive/2010/09/14/1825909.html

    参考:http://www.cnblogs.com/benio/archive/2010/09/14/1825909.html

  10. c#用正则表达式判断字符串是否全是数字、小数点、正负号组成 Regex reg = new Regex(@"^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$");

    Regex reg = new Regex(@"^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][ ...

随机推荐

  1. 据库连接中useSSL

    在进行数据库连接时: jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/db?useSSL=false&am ...

  2. IT工具知识-12:RTL8832AU网卡在WIN10更新KB5015807后出现无法正常连接的一种解决方法

    系统配置 硬件配置 使用网卡为Fenvi的FU-AX1800 USB外置网卡(官网驱动同AX1800P) 问题描述 在win10自动更新了KB5015807出现了wifi开机无法自动连接,wifi图标 ...

  3. 树莓派 wiringPi的BCM与BOARD编码

    一.基础命令使用wiringPi库 1.1.获取管教信息 gpio readall ---获取管脚信息   1.2.BOARD编码和BCM一般都在python库中使用 import RPi.GPIO ...

  4. JSON数据转对象遍历

    String json = "[{\"n\":\"北京\",\"i\":11,\"p\":0,\"y ...

  5. MySql创建表遇到的问题

    SQL语句如下: CREATE TABLE IF NOT EXISTS `student`{ `id` INT(4) NOT NULL COMMENT '学号', `name` VARCHAR(30) ...

  6. idea 切换database数据库方言

    在适配各种国产数据库时常常遇到存在数据库方言的情况,例如openGauss支持oracle兼容模式.. 在这种情况下,就需要在idea里对方言进行切换,否则无法执行oracle语法的sql. 1.连接 ...

  7. 遇到 https://packetlife.net/

    "I have never let my schooling interfere with my education." --Mark Twain

  8. mac下webstrom卡顿快速解决办法

    vim /Applications/WebStorm.app/Contents/bin/webstorm.vmoptions 一路回车 直到看到: 按insert 将顶部以下两项原有值修改为以下值: ...

  9. beta冲刺:总结随笔

    这个作业属于哪个课程 <班级的链接> 这个作业要求在哪里 <作业要求的链接> 这个作业的目标 beta冲刺总结 作业正文 .... 其他参考文献 ... 一.预期计划 | 6. ...

  10. conda使用杂记

    总纲 https://docs.anaconda.com/anaconda/navigator/ 其中有链接 miniconda https://docs.anaconda.com/anaconda/ ...