thegeeklab/webpack.config.js

64 lines
1.6 KiB
JavaScript
Raw Normal View History

const path = require("path")
const yaml = require("js-yaml")
const fs = require("fs")
const FaviconsWebpackPlugin = require("favicons-webpack-plugin")
const CopyPlugin = require("copy-webpack-plugin")
let config
try {
config = yaml.load(fs.readFileSync(path.join(__dirname, "config.yml"), "utf8"))
} catch (e) {
console.log(e)
}
module.exports = {
entry: [path.resolve("src", "dummy.js")],
output: {
filename: "../build/dummy.js",
path: path.join(__dirname, "static"),
publicPath: "/",
clean: true
},
plugins: [
new CopyPlugin({
patterns: [
{
from: "**/*",
context: path.resolve(__dirname, "src", "static")
2022-09-29 20:04:36 +00:00
},
{
from: "sprites/*.svg",
to: path.resolve(__dirname, "assets"),
context: path.resolve(__dirname, "build")
},
{
from: "img/*.svg",
context: path.resolve(__dirname, "build")
}
]
}),
new FaviconsWebpackPlugin({
logo: path.resolve("src", "static", "favicon", "favicon.svg"),
prefix: "favicon/",
inject: false,
favicons: {
appName: config.title,
appShortName: config.title.concat(" - ", config.params.subtitle),
appDescription: config.params.description,
background: "#2f333e",
theme_color: "#2f333e",
icons: {
android: { offset: 10 },
appleIcon: { offset: 10 },
appleStartup: { offset: 10 },
favicons: true,
windows: { offset: 10 },
yandex: false
}
}
})
]
}