Skip to content

Commit

Permalink
code splitting with multiple entry
Browse files Browse the repository at this point in the history
  • Loading branch information
fnurrahmah125 committed Nov 2, 2023
1 parent 4eb1528 commit 04bc74d
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 7 deletions.
2 changes: 0 additions & 2 deletions test-webpack/output/bundle.c84d4dda8a4df3a156cc.js

This file was deleted.

2 changes: 1 addition & 1 deletion test-webpack/output/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Belajar Webpack</title><script defer="defer" src="bundle.c84d4dda8a4df3a156cc.js"></script><link href="style.259cfe6f9f24f6511d67.css" rel="stylesheet"></head><body><img src="img/cat-d908827b839c650602c2.jpg" alt="image" class="cat-img"/><div class="row justify-content-center mt-5"><div class="col-4"><div class="card"><div class="card-header text-center"><h3>WPU Super App</h3></div><div class="card-body"><div class="alert alert-danger" role="alert" id="error">error!</div><h5 class="card-title">Kalkulator Sakti</h5><div class="input-group mb-3"><input class="form-control" placeholder="masukkan angka" id="operand1" autofocus required/> <span class="input-group-text">+</span> <input class="form-control" placeholder="masukkan angka" id="operand2" required/> <button class="btn btn-primary" type="button" id="tombol-tambah">Jumlahkan!</button></div><div class="card mt-3"><div class="card-body">Hasilnya adalah: <span id="hasil"></span></div></div></div><div class="card-footer text-center"><button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#jokesModal" id="jokes-receh">Jokes Receh!</button></div></div></div></div><div class="modal fade" id="jokesModal" tabindex="-1" aria-labelledby="jokesModalLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><h5 class="modal-title" id="jokesModalLabel">Joke Hari Ini 🤣</h5><button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div><div class="modal-body">...</div><div class="modal-footer"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Tutup</button></div></div></div></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Belajar Webpack</title><script defer="defer" src="main.e4b7653cf02e192897ed.js"></script><script defer="defer" src="vendor.7aa7351566afe8df91ac.js"></script><link href="style.259cfe6f9f24f6511d67.css" rel="stylesheet"></head><body><img src="img/cat-d908827b839c650602c2.jpg" alt="image" class="cat-img"/><div class="row justify-content-center mt-5"><div class="col-4"><div class="card"><div class="card-header text-center"><h3>WPU Super App</h3></div><div class="card-body"><div class="alert alert-danger" role="alert" id="error">error!</div><h5 class="card-title">Kalkulator Sakti</h5><div class="input-group mb-3"><input class="form-control" placeholder="masukkan angka" id="operand1" autofocus required/> <span class="input-group-text">+</span> <input class="form-control" placeholder="masukkan angka" id="operand2" required/> <button class="btn btn-primary" type="button" id="tombol-tambah">Jumlahkan!</button></div><div class="card mt-3"><div class="card-body">Hasilnya adalah: <span id="hasil"></span></div></div></div><div class="card-footer text-center"><button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#jokesModal" id="jokes-receh">Jokes Receh!</button></div></div></div></div><div class="modal fade" id="jokesModal" tabindex="-1" aria-labelledby="jokesModalLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><h5 class="modal-title" id="jokesModalLabel">Joke Hari Ini 🤣</h5><button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div><div class="modal-body">...</div><div class="modal-footer"><button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Tutup</button></div></div></div></div></body></html>
2 changes: 2 additions & 0 deletions test-webpack/output/main.e4b7653cf02e192897ed.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions test-webpack/output/vendor.7aa7351566afe8df91ac.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*!
* Bootstrap v5.3.2 (https://getbootstrap.com/)
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
2 changes: 1 addition & 1 deletion test-webpack/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as bootstrap from "bootstrap";
require("./vendor");
import css from "./style.scss";
import { run } from "./app/app.js";
import { AlertService } from "./app/services/alert.service.js";
Expand Down
1 change: 1 addition & 0 deletions test-webpack/src/vendor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import * as bootstrap from "bootstrap";
5 changes: 4 additions & 1 deletion test-webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const path = require("path");

module.exports = {
entry: "./src/index.js",
entry: {
main: "./src/index.js",
vendor: "./src/vendor.js",
},
plugins: [
new HtmlWebpackPlugin({
template: "./src/template.html",
Expand Down
2 changes: 1 addition & 1 deletion test-webpack/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = merge(config, {
},
output: {
path: path.resolve(__dirname, "output"),
filename: "bundle.js",
filename: "[name].js",
assetModuleFilename: "img/[name][ext]",
clean: true,
},
Expand Down
2 changes: 1 addition & 1 deletion test-webpack/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = merge(config, {
mode: "production",
output: {
path: path.resolve(__dirname, "output"),
filename: "bundle.[contenthash].js",
filename: "[name].[contenthash].js",
assetModuleFilename: "img/[name]-[hash][ext]",
clean: true,
},
Expand Down

0 comments on commit 04bc74d

Please sign in to comment.