Skip to content

Commit ff99c3f

Browse files
committed
added webpack-html-plugin and css-loader. Public directory now is ignored by git because all of that content is generated
1 parent f5a98e8 commit ff99c3f

File tree

3 files changed

+17
-48
lines changed

3 files changed

+17
-48
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
node_modules
33
npm-debug.log
44
.idea
5-
public/js/*
5+
public/
66
app.config.js
77
test/acceptance/_output

public/index.html

Lines changed: 0 additions & 42 deletions
This file was deleted.

webpack.config.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
const path = require('path');
2+
const HtmlWebpackPlugin = require('html-webpack-plugin');
3+
const webpack = require('webpack');
4+
const CleanWebpackPlugin = require('clean-webpack-plugin');
25

36
module.exports = {
47
entry: './src/client/index.js',
58
output: {
69
filename: 'main.js',
7-
path: path.resolve(__dirname, 'public/js')
10+
path: path.resolve(__dirname, 'public')
811
},
912

1013
mode:"development",
1114

1215
devServer: {
13-
hot: true,
14-
contentBase: path.join(__dirname, 'public'),
16+
contentBase:"public",
17+
hotOnly: true,
1518
compress: false,
1619
port: 8082,
1720
proxy: {
@@ -21,10 +24,18 @@ module.exports = {
2124

2225
module: {
2326
rules: [
24-
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" }
27+
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
28+
{
29+
test: /\.css$/,
30+
use: ['style-loader', 'css-loader'],
31+
},
2532
]
2633
},
27-
34+
plugins: [
35+
new CleanWebpackPlugin(['public']),
36+
new HtmlWebpackPlugin({template:path.join('src/client/index.html')}),
37+
new webpack.HotModuleReplacementPlugin(),
38+
],
2839
devtool: "source-map"
2940

3041
};

0 commit comments

Comments
 (0)