51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
const webpack = require("webpack");
|
|
const path = require("path");
|
|
const getConfig = require("./config");
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
|
|
process.env.NODE_ENV = "development";
|
|
const configs = getConfig("dev");
|
|
|
|
module.exports = {
|
|
mode: "development",
|
|
target: "web",
|
|
devtool: "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 webpack.DefinePlugin(configs),
|
|
new HtmlWebpackPlugin({
|
|
template: "src/index.html",
|
|
favicon: "src/favicon.ico"
|
|
}),
|
|
new webpack.ProvidePlugin({
|
|
process: "process/browser"
|
|
})
|
|
],
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(js|jsx)$/,
|
|
exclude: /node_modules/,
|
|
use: ["babel-loader", "eslint-loader"]
|
|
},
|
|
{
|
|
test: /(\.css)$/,
|
|
use: ["style-loader", "css-loader"]
|
|
}
|
|
]
|
|
}
|
|
};
|