Skip to content

Commit

Permalink
Initial project structure with webpack and webpack-plugin and watch mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin-Re committed Apr 6, 2022
0 parents commit 2e88007
Show file tree
Hide file tree
Showing 9 changed files with 7,074 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules/
9 changes: 9 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Output Management</title>
<meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="dist/main.js"></script></head>
<body>
</body>
</html>
208 changes: 208 additions & 0 deletions dist/main.js

Large diffs are not rendered by default.

6,797 changes: 6,797 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "todo",
"version": "1.0.0",
"description": "",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack --watch",
"build": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"css-loader": "^6.7.1",
"html-webpack-plugin": "^5.5.0",
"style-loader": "^3.3.1",
"webpack": "^5.71.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.8.1"
},
"start": "webpack serve --open"
}
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import printMe from "./print.js";
import css from './style.css';
printMe();
3 changes: 3 additions & 0 deletions src/print.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function printMe() {
console.log('I get called from print.js!');
}
3 changes: 3 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body {
background-color: blanchedalmond;
}
27 changes: 27 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
module: {
rules: [
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
],
},
devServer: {
static: "./dist",
},

mode: "development",
entry: "./src/index.js",
output: {
filename: "main.js",
publicPath: "dist",
},

plugins: [
new HtmlWebpackPlugin({
title: "Output Management",
}),
],
};

0 comments on commit 2e88007

Please sign in to comment.