-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
67 lines (66 loc) · 1.55 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const path = require('path');
// import path from 'path';
const HtmlWebpackPlugin = require('html-webpack-plugin');
// import HtmlWebpackPlugin from 'html-webpack-plugin';
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const Dotenv = require('dotenv-webpack');
module.exports = {
target: 'node',
mode: 'development',
entry: {
index: './source/js/index.js',
tetris: './source/js/tetris.js',
hangman: './source/js/hangman.js',
},
output: {
path: path.resolve(__dirname, 'public'),
filename: '[name]_bundle.js',
},
module: {
rules: [
{
test: /\.js$/,
use: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.(png|jpe?g|gif)$/i,
use: 'file-loader',
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
],
},
plugins: [
new Dotenv(),
new HtmlWebpackPlugin({
title: '클래식 고전 게임',
template: './source/index.html',
chunks: ['index'],
filename: './index.html',
}),
new HtmlWebpackPlugin({
title: '테트리스',
template: './source/games.html',
chunks: ['tetris'],
filename: './tetris.html',
inject: true,
meta: {
title: '테트리스 게임',
},
}),
new HtmlWebpackPlugin({
title: '행맨',
template: './source/games.html',
chunks: ['hangman'],
filename: './hangman.html',
inject: true,
meta: {
title: '행맨 게임',
},
}),
new CleanWebpackPlugin(),
],
};