-
Notifications
You must be signed in to change notification settings - Fork 198
/
webpack.config.js
110 lines (108 loc) · 2.81 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
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
/**
* ownCloud - Music app
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Pauli Järvinen <[email protected]>
* @copyright 2020 - 2024 Pauli Järvinen
*
*/
const path = require('path');
const webpack = require("webpack");
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ESLintPlugin = require('eslint-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const WebpackAssetsManifest = require('webpack-assets-manifest');
module.exports = {
mode: 'production',
devtool: 'source-map',
entry: {
app: './js/index.app.js',
dashboard_music_widget: './js/index.dashboard.js',
files_music_player: './js/index.embedded.js'
},
output: {
filename: 'webpack.[name].[contenthash].js',
path: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
alias: {
'node_modules': path.resolve(__dirname, 'node_modules'),
'shared': path.resolve(__dirname, 'js/shared'),
'vendor': path.resolve(__dirname, 'js/vendor'),
'angular': path.resolve('node_modules', 'angular'),
'lodash': path.resolve('node_modules', 'lodash'),
'jquery': path.resolve('node_modules', 'jquery/src/jquery'),
'blueimp-md5': path.resolve('node_modules', 'blueimp-md5'),
},
fallback: {
path: require.resolve("path-browserify")
}
},
plugins: [
new CleanWebpackPlugin(),
new MiniCssExtractPlugin({filename: 'webpack.[name].[contenthash].css'}),
new ESLintPlugin({files: './js'}),
new webpack.ProvidePlugin({
'$': 'jquery',
'window.$': 'jquery',
'jQuery': 'jquery',
'window.jQuery': 'jquery',
'_': 'lodash',
'window.AV': 'vendor/aurora/aurora.js'
}),
new WebpackAssetsManifest(),
],
module: {
rules: [
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
],
},
{
test: /\.(png|svg|jpg|gif)$/,
type: 'asset/resource',
generator: {
filename: 'img/[hash][ext]'
}
},
{
resourceQuery: /raw/,
type: 'asset/source',
},
{
include: path.resolve('node_modules', 'lodash'),
parser: { amd: false }
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
},
'ts-loader'
]
},
{
test: /\.m?js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
],
},
target: ['web', 'es5']
};