VersaWhiteboard/config/webpack.base.js

60 lines
1.5 KiB
JavaScript
Raw Normal View History

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");
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-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,
}),
],
};
module.exports = config;