加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.dev.js 1.47 KB
一键复制 编辑 原始数据 按行查看 历史
liuyong 提交于 2021-03-12 15:16 . 初始化
const path = require("path")
const webpack = require("webpack")
const HtmlWebpackPlugin = require("html-webpack-plugin")
module.exports = {
mode: "development",
entry: [
"react-hot-loader/patch", "./example/index.tsx"
// path.resolve(__dirname, "public/index.html"),
],
devServer: {
contentBase: path.resolve(__dirname, "dist"),
compress: true,
port: 9000,
open: true,
hot: true,
quiet: true,
},
output: {
filename: "[name].[contenthash:5].js",
path: path.resolve(__dirname, "dist"),
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "public/index.html"),
filename: "index.html",
}),
new webpack.HotModuleReplacementPlugin(),
],
module: {
rules: [
{
test: /\.tsx$/,
use: [
{
loader: "babel-loader",
options: { plugins: ["react-hot-loader/babel"] },
},
{ loader: "ts-loader" },
],
},
{
test: /\.scss$/,
use: [
"style-loader",
"@teamsupercell/typings-for-css-modules-loader",
{
loader: "css-loader",
options: {
modules: true,
},
},
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [["postcss-preset-env"]],
},
},
},
"sass-loader",
],
},
],
},
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化