webui-aria2/webpack.config.js

52 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-08-31 10:57:06 +02:00
const path = require("path");
const webpack = require("webpack");
2018-08-31 10:57:06 +02:00
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CleanWebpackPlugin = require("clean-webpack-plugin");
2018-08-31 10:57:06 +02:00
const BUILD_DIR = path.join(__dirname, "build");
const APP_DIR = path.join(__dirname, "src", "js");
const config = {
entry: {
app: APP_DIR + "/app.js"
},
2018-08-31 10:57:06 +02:00
module: {
rules: [
{
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader", "sass-loader"]
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader"]
}
]
},
output: {
path: BUILD_DIR,
filename: "[name].js"
},
plugins: [
2018-08-31 10:57:06 +02:00
new CleanWebpackPlugin(["build"]),
new webpack.ProvidePlugin({
"window.jQuery": "jquery",
jQuery: "jquery",
$: "jquery"
2018-08-31 10:57:06 +02:00
}),
new HtmlWebpackPlugin({
template: "src/index-template.html",
inject: "head"
}),
new MiniCssExtractPlugin({
filename: "[name].css"
})
],
resolve: {
2018-08-31 10:57:06 +02:00
modules: [path.resolve("./node_modules"), path.resolve("./src/js"), path.resolve("./src/scss")]
}
};
module.exports = config;