-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.basis.js
99 lines (92 loc) · 2.12 KB
/
webpack.config.basis.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
// const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
const moduleRulesConfig = [
{
test: /\.css$/,
use: addMiniCssExtractPlugin([
'style-loader',
'css-loader',
]),
exclude: /\.module\.css$/,
},
{
test: /\.scss$/,
sideEffects: true,
use: addMiniCssExtractPlugin([
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 2,
modules: {
localIdentName: '[name]__[local]',
},
},
},
'postcss-loader',
{
loader: 'sass-loader',
options: {
implementation: require('sass'),
sourceMap: true
}
}
,
]),
},
{
test: /\.(svg|gif)$/,
use: [{
loader: 'url-loader',
options: {
limit: 5000,
outputPath: 'images/',
name: '[name].[ext]'
}
}]
},
{
test: /\.ts(x)?$/,
use: ['awesome-typescript-loader'],
exclude: /node_modules/,
}
]
const config = {
devtool: 'source-map',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
library: 'Videoplayer',
libraryTarget: 'umd',
umdNamedDefine: true,
publicPath: '/'
},
// resolveLoader: {
// modules: ['node_modules', './loader']
// },
resolve: {
extensions: ['.js', '.jsx', '.tsx', '.ts','js', 'jsx', 'tsx', 'ts'],
alias: {
'react-dom': '@hot-loader/react-dom',
'@g': path.resolve(__dirname, './src'),
'@player': path.resolve(__dirname, './src/player'),
'@interfaces': path.resolve(__dirname, './src/interfaces'),
'@component': path.resolve(__dirname, './src/component'),
'@codes': path.resolve(__dirname, './src/codecs'),
'@images': path.resolve(__dirname, './src/images'),
'@utils': path.resolve(__dirname, './src/utils'),
},
},
};
function addMiniCssExtractPlugin(arr) {
let copyarr = arr.concat();
// if (envPrd) {
// copyarr.splice(1, 0, { loader: MiniCssExtractPlugin.loader })
// return copyarr
// }
return copyarr
}
module.exports = {
moduleRulesConfig,
config
}