2020-04-19 16:33:55 +02:00
|
|
|
const webpack = require("webpack");
|
2020-05-09 15:40:26 +02:00
|
|
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
|
|
|
const CopyPlugin = require("copy-webpack-plugin");
|
|
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
2020-04-19 16:33:55 +02:00
|
|
|
const path = require("path");
|
|
|
|
|
|
|
|
const config = {
|
2020-05-09 15:40:26 +02:00
|
|
|
entry: {
|
|
|
|
main: ["./src/js/index.js"],
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, "..", "dist"),
|
|
|
|
filename: "[name]-[hash].js",
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ["*", ".json", ".js"],
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.(js)$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loader: "babel-loader",
|
|
|
|
options: {
|
|
|
|
compact: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: ["style-loader", "css-loader"],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(png|jpe?g|gif)$/i,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: "file-loader",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-04-19 16:33:55 +02:00
|
|
|
],
|
2020-05-09 15:40:26 +02:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin(),
|
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
$: "jquery",
|
|
|
|
jQuery: "jquery",
|
|
|
|
"window.jQuery": "jquery",
|
|
|
|
"window.$": "jquery",
|
|
|
|
}),
|
|
|
|
new CopyPlugin([{ from: "assets", to: "" }]),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
template: "src/index.html",
|
|
|
|
minify: false,
|
|
|
|
inject: true,
|
|
|
|
}),
|
|
|
|
],
|
2020-04-19 16:33:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = config;
|