forked from aesirxio/joomla-bi-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
66 lines (57 loc) · 1.24 KB
/
webpack.common.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
const MediaQueryPlugin = require('media-query-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
const wwwDir = path.resolve(__dirname, './dist');
const projectname = 'aesirx-bi';
const sassData = {
loader: 'sass-loader',
};
const sassLoader = {
test: /\.(scss)$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
MediaQueryPlugin.loader,
'postcss-loader',
sassData,
],
};
const imageLoader = {
test: /\.(gif|png|jpe?g|svg)$/i,
type: 'asset/resource',
generator: {
filename: 'image/[contenthash][ext][query]',
},
};
const fontLoader = {
test: /\.(woff|woff2|eot|ttf|otf)$/,
type: 'asset/resource',
generator: {
filename: 'fonts/[contenthash][ext][query]',
},
};
const jsLoader = {
test: /\.js$/,
exclude: /node_modules\/(?!(dom7|ssr-window|swiper)\/).*/,
use: {
loader: 'babel-loader',
},
};
const aliasData = {
src: path.resolve(__dirname, './src'),
react$: require.resolve(path.resolve(__dirname, './node_modules/react')),
};
const cssLoader = {
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
};
module.exports = {
wwwDir,
projectname,
sassLoader,
imageLoader,
fontLoader,
jsLoader,
cssLoader,
aliasData,
};