-
-
Notifications
You must be signed in to change notification settings - Fork 256
/
webpack.config.js
57 lines (56 loc) · 1.54 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
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const ConcatPlugin = require('@mcler/webpack-concat-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: {
backend: './phpmyfaq/admin/assets/src/index.js',
frontend: './phpmyfaq/assets/src/frontend.js',
setup: './phpmyfaq/assets/src/setup.js',
styles: './phpmyfaq/assets/themes/default/scss/style.scss',
admin: './phpmyfaq/admin/assets/scss/style.scss',
},
devtool: 'source-map',
output: {
path: path.resolve(__dirname, 'phpmyfaq/assets/dist'),
},
mode: 'development',
watchOptions: {
aggregateTimeout: 200,
poll: 1000,
},
plugins: [
new CleanWebpackPlugin(),
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
}),
// Concat phpMyFAQ TinyMCE plugin and uglify it
new ConcatPlugin({
fileName: '../../../phpmyfaq/assets/dist/plugins/phpmyfaq/plugin.js',
filesToConcat: [path.resolve(__dirname, 'phpmyfaq/admin/assets/src/tinymce/phpmyfaq.tinymce.plugin.js')],
}),
],
module: {
rules: [
{
test: /\.scss$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
'css-loader',
'sass-loader',
],
},
{
test: /\.(jpe?g|svg|png|gif|ico|eot|ttf|woff2?)(\?v=\d+\.\d+\.\d+)?$/i,
type: 'asset/resource',
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
],
},
};