Skip to content

Commit 4d9af8c

Browse files
authored
Proposal: Let's Replace Parcel With Webpack (#2641)
* Proposal: Let's Replace Parcel With Webpack Closes #2487 and #2474 This is just a development server at this point. It hot reloads HTML JS and CSS. That's enough for me. I'm open to contrary opinions. * Updates based on @coliff review * wip * fix merge conflict * removing comment * Final tweaks to docs
1 parent 9a7b606 commit 4d9af8c

File tree

14 files changed

+1601
-12680
lines changed

14 files changed

+1601
-12680
lines changed

.eslintrc.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ module.exports = {
22
env: {
33
browser: true,
44
es6: true,
5-
mocha: true
5+
mocha: true,
6+
node : true
67
},
7-
plugins: ["mocha"],
8-
extends: "eslint:recommended",
8+
plugins: ['mocha'],
9+
extends: 'eslint:recommended',
910
parserOptions: {
10-
sourceType: "module"
11+
sourceType: 'module'
1112
},
1213
rules: {
13-
indent: ["error", 2],
14-
quotes: ["error", "single"],
15-
semi: ["error", "always"]
14+
indent: ['error', 2],
15+
quotes: ['error', 'single'],
16+
semi: ['error', 'always']
1617
}
1718
};

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Choose one of the following options:
5656
npx create-html5-boilerplate new-site
5757
cd new-site
5858
npm install
59-
npm start
59+
npm run start
6060
```
6161

6262
## Features
@@ -72,7 +72,7 @@ Choose one of the following options:
7272
* [`Apache Server Configs`](https://github.com/h5bp/server-configs-apache)
7373
that improve the web site's performance and security
7474
* Placeholder Open Graph elements and attributes.
75-
* An example package.json file with [Parcel](https://parceljs.org/) commands
75+
* An example package.json file with [WebPack](https://webpack.js.org/) commands
7676
built in to jumpstart application development
7777
* Placeholder CSS Media Queries.
7878
* Useful CSS helper classes.

dist/doc/misc.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,11 @@ if you're interested. The fields we provide are as follows:
169169
node environment. There are many [built-in keys](https://docs.npmjs.com/misc/scripts)
170170
related to the package lifecycle that node understands automatically. You can
171171
also define custom scripts for use with your application development. We
172-
provide three custom scripts that work with Parcel to get you up and running
172+
provide three custom scripts that work with WebPack to get you up and running
173173
quickly with a bundler for your assets and a simple development server.
174174

175-
* `start` builds your site and starts a server
176-
* `build` builds your `index.html` using Parcel
177-
* `dev` serves your `index.html` with a simple development server
178-
175+
* `start` serves your `index.html` with a simple development server
176+
179177
* `keywords` - an array of keywords used to discover your app in the npm
180178
registry
181179
* `author` - defines the author of a package. There is also an alternative
@@ -184,5 +182,4 @@ if you're interested. The fields we provide are as follows:
184182
* `license` - the license for your application. Must conform to
185183
[specific rules](https://docs.npmjs.com/files/package.json#license)
186184
* `devDependencies` - development dependencies for your package. In our case
187-
it's a single dependency, Parcel, which we use to bundle files and run a
188-
simple web server.
185+
we have several dependencies used by WebPack, which we use as a simple development server.

dist/doc/usage.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ A basic HTML5 Boilerplate site initially looks something like this:
5151
├── robots.txt
5252
├── site.webmanifest
5353
├── tile.png
54-
└── tile-wide.png
54+
├── tile-wide.png
55+
└── webpack.config.js
5556
```
5657

5758
What follows is a general overview of each major part and how to use them.
@@ -110,9 +111,6 @@ need to integrate this starting HTML with your setup.
110111
Make sure that you update the URLs for the referenced CSS and JavaScript if you
111112
modify the directory structure at all.
112113

113-
If you are using Google Universal Analytics, make sure that you edit the
114-
corresponding snippet at the bottom to include your analytics ID.
115-
116114
### humans.txt
117115

118116
Edit this file to include the team that worked on your site/app, and the

dist/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414

1515
<link rel="icon" href="/favicon.ico" sizes="any">
1616
<link rel="icon" href="/icon.svg" type="image/svg+xml">
17-
1817
<link rel="apple-touch-icon" href="icon.png">
19-
<!-- Place favicon.ico in the root directory -->
2018

2119
<link rel="stylesheet" href="css/normalize.css">
2220
<link rel="stylesheet" href="css/style.css">

dist/package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
"name": " ",
33
"version": "0.0.1",
44
"description": "",
5-
"keywords": [""],
5+
"keywords": [
6+
""
7+
],
68
"license": "",
79
"author": "",
810
"scripts": {
9-
"build": "parcel build index.html",
10-
"dev": "parcel index.html --open",
11-
"start": "npm run build && npm run dev",
12-
"test": "echo \"Error: no test specified\" && exit 1"
11+
"test": "echo \"Error: no test specified\" && exit 1",
12+
"start": "webpack-dev-server --open --port 8080"
1313
},
1414
"devDependencies": {
15-
"parcel-bundler": "^1.12.5"
15+
"webpack": "^5.64.1",
16+
"html-webpack-plugin": "^5.5.0",
17+
"webpack-cli": "^4.9.1",
18+
"webpack-dev-server": "^4.5.0"
1619
}
1720
}

dist/webpack.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const HtmlWebpackPlugin = require('html-webpack-plugin');
2+
module.exports = {
3+
mode : 'development',
4+
entry : './js/app.js',
5+
devServer: {
6+
liveReload: true,
7+
hot: true,
8+
open: true,
9+
static: ['./'],
10+
},
11+
plugins: [
12+
new HtmlWebpackPlugin({
13+
template: './index.html'
14+
})
15+
]
16+
};

0 commit comments

Comments
 (0)