Repository navigation
Expand file tree
/
Copy pathwebpack.common.js
More file actions
120 lines (119 loc) · 2.99 KB
/
Copy pathwebpack.common.js
File metadata and controls
120 lines (119 loc) · 2.99 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
const path = require('path');
const webpack = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const ESLintWebpackPlugin = require('eslint-webpack-plugin');
module.exports = {
target: 'web',
entry: { index: './src/client/index.ts', admin: './src/client/admin.ts' },
plugins: [
new webpack.ProvidePlugin({
PIXI: 'pixi.js',
}),
new CleanWebpackPlugin({ verbose: true }),
new HtmlWebpackPlugin({
title: '메이플 무자본 대회',
filename: '../index.html',
excludeChunks: ['admin'],
}),
new HtmlWebpackPlugin({
template: 'src/client/views/admin.html',
filename: '../admin.html',
chunks: ['admin'],
}),
new CopyPlugin({
patterns: [{ from: 'src/client/assets', to: '../assets' }],
}),
new ESLintWebpackPlugin({ extensions: ['ts', 'js'] }),
],
resolve: {
extensions: ['.ts', '.js', '.mjs', '.json'],
},
output: {
path: path.resolve(__dirname, 'dist/public/js'),
publicPath: 'js',
filename: '[name].[contenthash].js',
},
optimization: {
moduleIds: 'hashed',
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
},
},
},
},
module: {
rules: [
{
test: /\.(ts|js|mjs)$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-typescript'],
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
['@babel/plugin-proposal-class-properties', { loose: false }],
'@babel/proposal-object-rest-spread',
[
'@babel/transform-runtime',
{
corejs: 3,
},
],
],
},
},
exclude: /node_modules/,
},
{
test: /\.m?js$/,
include: /node_modules\/pixi.js/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
},
{
test: /\.m?js$/,
include: /node_modules\/pixi-filters/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
},
{
test: /\.m?js$/,
include: /node_modules\/@pixi\/ui/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
},
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(png|svg|jpg|gif)$/,
use: ['file-loader'],
},
],
},
};