2021-07-21 00:08:57 +00:00
|
|
|
const CopyPlugin = require("copy-webpack-plugin");
|
|
|
|
const { glob } = require("glob");
|
|
|
|
const path = require("path");
|
|
|
|
|
2021-07-21 06:58:49 +00:00
|
|
|
let config = {
|
2022-01-27 06:55:46 +00:00
|
|
|
entry: glob.sync(path.resolve("./assets/js/specific/*.js")).reduce(
|
|
|
|
(obj, elem) => {
|
|
|
|
let name = elem.substr(path.resolve("./assets/js/").length);
|
|
|
|
name = name.substring(0, name.length - path.extname(name).length);
|
|
|
|
obj[name] = elem;
|
|
|
|
return obj;
|
|
|
|
},
|
|
|
|
{
|
|
|
|
site: [
|
|
|
|
path.resolve("./assets/js/site.js"),
|
|
|
|
path.resolve("./assets/js/dependencies.js"),
|
|
|
|
path.resolve("./assets/styles/site.scss"),
|
|
|
|
path.resolve("./assets/styles/dependencies.css")
|
|
|
|
],
|
|
|
|
}
|
|
|
|
),
|
2021-07-21 00:08:57 +00:00
|
|
|
output: {
|
|
|
|
filename: "[name].js",
|
|
|
|
path: path.resolve("./wwwroot/js"),
|
2021-07-24 04:45:10 +00:00
|
|
|
clean: true,
|
2021-07-21 00:08:57 +00:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.m?js$/,
|
|
|
|
exclude: /(node_modules|bower_components)/,
|
|
|
|
use: {
|
|
|
|
loader: "babel-loader",
|
|
|
|
options: {
|
2021-07-22 21:12:27 +00:00
|
|
|
presets: ["@babel/preset-env"],
|
|
|
|
plugins: ["@babel/plugin-transform-runtime"]
|
2021-07-21 00:08:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2021-07-24 04:45:10 +00:00
|
|
|
{
|
|
|
|
test: /\.s[ac]ss$/i,
|
|
|
|
use: [
|
|
|
|
"style-loader",
|
|
|
|
"css-loader",
|
|
|
|
"sass-loader",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/i,
|
|
|
|
use: ["style-loader", "css-loader"],
|
|
|
|
},
|
2021-07-21 00:08:57 +00:00
|
|
|
{
|
|
|
|
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
|
|
|
type: "asset/resource",
|
2021-07-24 04:45:10 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
|
|
type: "asset/resource",
|
|
|
|
},
|
2021-07-21 00:08:57 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
"~": path.resolve("./"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new CopyPlugin({
|
|
|
|
patterns: [
|
|
|
|
{
|
|
|
|
from: path.resolve("./assets/images"), to: path.resolve("./wwwroot/images"),
|
|
|
|
}
|
|
|
|
],
|
|
|
|
})
|
|
|
|
]
|
|
|
|
};
|
2021-07-21 06:58:49 +00:00
|
|
|
|
2021-07-23 01:25:41 +00:00
|
|
|
module.exports = config;
|