Skip to content

Commit 8c11efc

Browse files
committed
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.
1 parent 0fc6689 commit 8c11efc

File tree

5 files changed

+47
-10
lines changed

5 files changed

+47
-10
lines changed

dist/package.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
"license": "",
77
"author": "",
88
"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"
9+
"test": "echo \"Error: no test specified\" && exit 1",
10+
"start": "webpack-dev-server --open --port 8080"
11+
},
12+
"dependencies": {
13+
"webpack": "^4.36.1"
1314
},
1415
"devDependencies": {
15-
"parcel-bundler": "^1.12.5"
16+
"html-webpack-plugin": "^3.2.0",
17+
"webpack-cli": "^3.3.6",
18+
"webpack-dev-server": "^3.7.2"
1619
}
1720
}

dist/webpack.config.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const HtmlWebpackPlugin = require('html-webpack-plugin');
2+
module.exports = {
3+
entry : "./js/main.js",
4+
devServer: {
5+
liveReload: true,
6+
watchContentBase: true,
7+
inline: true,
8+
hot: true,
9+
},
10+
plugins: [
11+
new HtmlWebpackPlugin({
12+
template: './index.html'
13+
})
14+
]
15+
};

src/package.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
"license": "",
77
"author": "",
88
"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"
9+
"test": "echo \"Error: no test specified\" && exit 1",
10+
"start": "webpack-dev-server --open --port 8080"
11+
},
12+
"dependencies": {
13+
"webpack": "^4.36.1"
1314
},
1415
"devDependencies": {
15-
"parcel-bundler": "^1.12.5"
16+
"html-webpack-plugin": "^3.2.0",
17+
"webpack-cli": "^3.3.6",
18+
"webpack-dev-server": "^3.7.2"
1619
}
1720
}

src/webpack.config.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const HtmlWebpackPlugin = require('html-webpack-plugin');
2+
module.exports = {
3+
entry : "./js/main.js",
4+
devServer: {
5+
liveReload: true,
6+
watchContentBase: true,
7+
inline: true,
8+
hot: true,
9+
},
10+
plugins: [
11+
new HtmlWebpackPlugin({
12+
template: './index.html'
13+
})
14+
]
15+
};

test/file_existence.js

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const expectedFilesInDistDir = [
2020
'404.html',
2121
'package.json',
2222
'browserconfig.xml',
23+
'webpack.config.js',
2324

2425
'css/', // for directories, a `/` character
2526
// should be included at the end

0 commit comments

Comments
 (0)