forked from omegaup/omegaup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config-grader.js
100 lines (98 loc) · 2.35 KB
/
webpack.config-grader.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
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
const path = require('path');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
name: 'grader',
entry: {
grader_ephemeral: [
'@babel/polyfill',
'./frontend/www/js/omegaup/grader/ephemeral.js',
],
},
optimization: {},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/env'],
cacheDirectory: true,
},
},
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.ttf$/,
use: ['file-loader'],
},
],
},
optimization: {
realContentHash: true,
},
resolve: {
alias: {
vue$: 'vue/dist/vue.common.js',
'vue-async-computed': 'vue-async-computed/dist/vue-async-computed.js',
},
fallback: {
buffer: require.resolve('buffer/'),
stream: require.resolve('stream-browserify'),
},
},
plugins: [
new VueLoaderPlugin(),
new MonacoWebpackPlugin(),
new HtmlWebpackPlugin({
template: path.resolve(
__dirname,
'frontend/www/grader/ephemeral/templates',
'index-light.html',
),
filename: path.resolve(
__dirname,
'frontend/www/grader/ephemeral',
'index-light.html',
),
scriptLoading: 'defer',
}),
new HtmlWebpackPlugin({
template: path.resolve(
__dirname,
'frontend/www/grader/ephemeral/templates',
'index.html',
),
filename: path.resolve(
__dirname,
'frontend/www/grader/ephemeral',
'index.html',
),
scriptLoading: 'defer',
}),
new CleanWebpackPlugin({
verbose: true,
dry: false,
cleanOnceBeforeBuildPatterns: ['grader_ephemeral-*'],
dangerouslyAllowCleanPatternsOutsideProject: true,
}),
],
output: {
path: path.resolve(__dirname, './frontend/www/js/dist/'),
publicPath: '/js/dist/',
filename: '[name]-[contenthash].js',
library: '[name]',
libraryTarget: 'umd',
},
};