Ai
7 Star 39 Fork 7

哈浪/react-hooks

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.dev.js 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
halang 提交于 2022-05-13 17:07 +08:00 . 加入eslint规范
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin'); // 本都服务
const autoprefixer = require('autoprefixer'); // 自动加前缀,处理兼容性问题
const webpack = require('webpack')
const {merge} = require('webpack-merge')
const common = require('./webpack.config')
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); // 样式隔离
// 获取 package.json 中的 name 字段值
console.log(process.env.npm_package_name)
// 获取 package.json 中的 version 字段值
console.log(process.env.npm_package_version)
console.log(process.env)
module.exports = merge(common,
{
mode: 'development', // 指定构建模式
devtool: 'inline-source-map', // 加入devtool配置,做相关的错误映射
devServer: {
static: {
directory: path.join(__dirname, 'dist'),
},
compress: true,
open: true, // 自动打开浏览器
hot: true, // 热加载的配置
port: 9002,
liveReload: true
},
plugins: [
// new webpack.ProgressPlugin(), // 百分比显示
new webpack.HotModuleReplacementPlugin(), // 热加载的配置 要加上hot:true
new MiniCssExtractPlugin({
filename: '[name].css'
}),
],
optimization: {
runtimeChunk: 'single',
moduleIds: 'named', //配置hot加载,替代webpack4的 new webpack.NamedModulesPlugin(),
}
}
)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ha-lang/react-hooks.git
git@gitee.com:ha-lang/react-hooks.git
ha-lang
react-hooks
react-hooks
master

搜索帮助