webpack config

master
Tudor Stanciu 2020-04-10 01:40:11 +03:00
parent 3f3c221ad0
commit 167db9f371
3 changed files with 63 additions and 0 deletions

11
src/index.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Pluralsight Redux</title>
</head>
<body>
<div id="app"></div>
</body>
</html>

8
src/index.js Normal file
View File

@ -0,0 +1,8 @@
import React from "react";
import { render } from "react-dom";
function Hi() {
return <p>Hi.</p>;
}
render(<Hi />, document.getElementById("app"));

44
webpack.config.dev.js Normal file
View File

@ -0,0 +1,44 @@
const webpack = require("webpack");
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
process.env.NODE_ENV = "developent";
module.exports = {
node: "development",
target: "web",
devTools: "cheap-module-source-map",
entry: "./src/index",
output: {
path: path.resolve(__dirname, "build"),
publicPath: "/",
filename: "bundle.js",
},
devServer: {
stats: "minimal",
overlay: true,
historyApiFallback: true,
disableHostCheck: true,
headers: { "Access-Control-Allow-Origin": "*" },
https: false,
},
plugins: [
new HtmlWebpackPlugin({
template: "src/index.html",
favicon: "src/favicon.ico",
}),
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ["babel-loader"],
},
{
test: /(\.css)$/,
use: ["style-loader", "css-loader"],
},
],
},
};