use a module manually

This commit is contained in:
Michael Peters 2023-01-09 13:27:17 -08:00
parent 4170a3e363
commit 2b812f3d7e
5 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,6 @@
Template Webpack Starting Project
Will include support for
Will (eventually) include support for
- HTML
- ESM
- TypeScript

View File

@ -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

View File

@ -1,6 +1,9 @@
import { doWork } from "./module.js";
function createComponent() {
const elem = document.createElement("div");
elem.innerText = "Hello, Webpack";
doWork();
return elem;
}

3
src/module.js Normal file
View File

@ -0,0 +1,3 @@
export function doWork() {
console.log("doing some major work right now");
}

View File

@ -4,6 +4,6 @@
<title>Webpack Starter</title>
</head>
<body>
<script src="./index.js"></script>
<script src="./index.js" type="module"></script>
</body>
</html>