Skip to content

Commit

Permalink
Improve dist contents
Browse files Browse the repository at this point in the history
* Output as original filename
* Use polyfills for htmls
  • Loading branch information
HashidaTKS committed Sep 30, 2024
1 parent d7c2bd7 commit 18964e9
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ module.exports = async (env, options) => {
devtool: "source-map",
entry: {
polyfill: ["core-js/stable", "regenerator-runtime/runtime"],
app: ["./src/web/app.js", "./src/web/app.html"],
dialog: ["./src/web/dialog.js", "./src/web/dialog.html"],
app: ["./src/web/app.js"],
dialog: ["./src/web/dialog.js"],
},
output: {
clean: true,
Expand All @@ -30,7 +30,7 @@ module.exports = async (env, options) => {
module: {
rules: [
{
test: /\.js$/,
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
Expand All @@ -39,11 +39,6 @@ module.exports = async (env, options) => {
},
},
},
{
test: /\.html$/,
exclude: /node_modules/,
use: "html-loader",
},
{
test: /\.(png|jpg|jpeg|gif|ico)$/,
type: "asset/resource",
Expand All @@ -57,10 +52,14 @@ module.exports = async (env, options) => {
new HtmlWebpackPlugin({
filename: "app.html",
template: "./src/web/app.html",
chunks: ["polyfill", "app"],
chunks: ["polyfill"],
}),
new CopyWebpackPlugin({
patterns: [
{
from: "src/web/*.css",
to: "[name][ext][query]",
},
{
from: "assets/*",
to: "assets/[name][ext][query]",
Expand All @@ -81,7 +80,7 @@ module.exports = async (env, options) => {
new HtmlWebpackPlugin({
filename: "dialog.html",
template: "./src/web/dialog.html",
chunks: ["polyfill", "dialog"],
chunks: ["polyfill"],
}),
],
devServer: {
Expand Down

0 comments on commit 18964e9

Please sign in to comment.