43 lines
936 B
JavaScript
43 lines
936 B
JavaScript
const path = require("path");
|
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
|
|
module.exports = {
|
|
entry: {
|
|
app: "./src/index.js",
|
|
},
|
|
plugins: [
|
|
// new CleanWebpackPlugin(['dist/*']) for < v2 versions of CleanWebpackPlugin
|
|
new CleanWebpackPlugin(),
|
|
new HtmlWebpackPlugin({
|
|
template: "index.html",
|
|
}),
|
|
],
|
|
output: {
|
|
filename: "[name].bundle.js",
|
|
path: path.resolve(__dirname, "dist"),
|
|
chunkFilename: "[name].bundle.js",
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: "babel-loader",
|
|
},
|
|
},
|
|
{
|
|
test: /\.css$/i,
|
|
use: ["style-loader", "css-loader"],
|
|
},
|
|
{
|
|
test: /\.html$/i,
|
|
loader: "html-loader",
|
|
options: {
|
|
attributes: true,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
};
|