From 2b812f3d7eb3e92370270f371f2899bdbd7ce0c0 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Mon, 9 Jan 2023 13:27:17 -0800 Subject: [PATCH] use a module manually --- README.md | 2 +- makefile | 4 ++-- src/index.js | 3 +++ src/module.js | 3 +++ static/index.html | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 src/module.js diff --git a/README.md b/README.md index 05eb1c2..020a012 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Template Webpack Starting Project -Will include support for +Will (eventually) include support for - HTML - ESM - TypeScript diff --git a/makefile b/makefile index a8a8c92..9c3d5b5 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,7 @@ build: mkdir -p dist - cp static/index.html dist/ - cp src/index.js dist/ + cp -r static/* dist/ + cp -r src/* dist/ dev-server: python -m http.server --directory dist/ 8700 diff --git a/src/index.js b/src/index.js index ec9ece0..d30cce9 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,9 @@ +import { doWork } from "./module.js"; + function createComponent() { const elem = document.createElement("div"); elem.innerText = "Hello, Webpack"; + doWork(); return elem; } diff --git a/src/module.js b/src/module.js new file mode 100644 index 0000000..b433ccb --- /dev/null +++ b/src/module.js @@ -0,0 +1,3 @@ +export function doWork() { + console.log("doing some major work right now"); +} diff --git a/static/index.html b/static/index.html index d7c3586..2dbe77c 100644 --- a/static/index.html +++ b/static/index.html @@ -4,6 +4,6 @@ Webpack Starter - +