-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.common.js
More file actions
117 lines (116 loc) · 4.32 KB
/
Copy pathwebpack.common.js
File metadata and controls
117 lines (116 loc) · 4.32 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const WebpackConcatPlugin = require('webpack-concat-files-plugin');
const terser = require('terser');
module.exports = {
entry: {
sbplus: path.resolve(__dirname, './sources/scripts/sbplus-dev.js'),
},
output: {
filename: 'sources/scripts/[name].js',
path: path.resolve(__dirname, 'dist'),
clean: true,
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {},
},
},
{
test: /\.(sa|sc|c)ss$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
url: false,
},
},
'postcss-loader',
{
loader: 'sass-loader',
options: {
// Prefer `dart-sass`
implementation: require.resolve('sass'),
},
},
],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: 'index.html',
filename: path.resolve(__dirname, 'dist', 'index.html'),
chunks: ['sbplus'],
inject: false,
links: [
'https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap',
'https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&icon_names=add_circle,check,chevron_backward,chevron_forward,close,close_fullscreen,cognition_2,content_copy,do_not_disturb_on,download,forward_10,info,list,more_horiz,notes,open_in_full,person,replay_10,settings,warning&display=swap',
'sources/scripts/libs/videojs/video-js.min.css',
'sources/scripts/libs/videojs/video.min.js'
],
}),
new CopyWebpackPlugin({
patterns: [
{
from: 'assets',
to: 'assets',
},
{
from: 'sources/manifest.json',
to: 'sources/manifest.json',
},
{
from: 'sources/images',
to: 'sources/images',
},
{
from: 'sources/manifest.json',
to: 'sources',
},
{
from: 'sources/scripts/libs',
to: 'sources/scripts/libs',
globOptions: {
ignore: ['**/videojs/plugins/**'],
},
},
{
from: 'sources/scripts/templates',
to: 'sources/scripts/templates',
},
],
}),
new WebpackConcatPlugin({
bundles: [
{
dest: './dist/sources/scripts/libs/videojs/video.min.js',
src: [
'./sources/scripts/libs/videojs/video.min.js',
'./sources/scripts/libs/videojs/plugins/quality-selector/quality-selector.js',
'./sources/scripts/libs/videojs/plugins/cuepoint/videojs.cuepoints.js',
'./sources/scripts/libs/videojs/plugins/markers/videojs-markers.js',
'./sources/scripts/libs/videojs/plugins/youtube/youtube.js'
],
transforms: {
after: async (code) => {
const minifiedCode = await terser.minify(code, { keep_fnames: true, keep_classnames: true });
return minifiedCode.code;
},
},
},
],
}),
new MiniCssExtractPlugin({
filename: 'sources/css/[name].css',
}),
],
};