Harrison Deng
9f291dcfed
Some checks failed
ydeng/props/pipeline/head There was a failure building this commit
Changed entrypointSize performance hint limit. Increased maxAssetSize webpack performance hint limit.
83 lines
2.3 KiB
JavaScript
83 lines
2.3 KiB
JavaScript
const CopyPlugin = require("copy-webpack-plugin");
|
|
const { glob } = require("glob");
|
|
const path = require("path");
|
|
|
|
let config = {
|
|
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")
|
|
],
|
|
}
|
|
),
|
|
output: {
|
|
filename: "[name].js",
|
|
path: path.resolve("./wwwroot/js"),
|
|
clean: true,
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.m?js$/,
|
|
exclude: /(node_modules|bower_components)/,
|
|
use: {
|
|
loader: "babel-loader",
|
|
options: {
|
|
presets: ["@babel/preset-env"],
|
|
plugins: ["@babel/plugin-transform-runtime"]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
test: /\.s[ac]ss$/i,
|
|
use: [
|
|
"style-loader",
|
|
"css-loader",
|
|
"sass-loader",
|
|
],
|
|
},
|
|
{
|
|
test: /\.css$/i,
|
|
use: ["style-loader", "css-loader"],
|
|
},
|
|
{
|
|
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
|
type: "asset/resource",
|
|
},
|
|
{
|
|
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
type: "asset/resource",
|
|
},
|
|
]
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"~": path.resolve("./"),
|
|
},
|
|
},
|
|
plugins: [
|
|
new CopyPlugin({
|
|
patterns: [
|
|
{
|
|
from: path.resolve("./assets/images"), to: path.resolve("./wwwroot/images"),
|
|
}
|
|
],
|
|
})
|
|
],
|
|
performance: {
|
|
maxEntrypointSize: 1048576,
|
|
maxAssetSize: 1048576
|
|
},
|
|
};
|
|
|
|
module.exports = config;
|