-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathcommon.config.js
More file actions
110 lines (100 loc) · 2.53 KB
/
common.config.js
File metadata and controls
110 lines (100 loc) · 2.53 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
const path = require('path');
const ESLintPlugin = require('eslint-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const { minFilenamePart } = require('./build-utils');
const VERSION = JSON.stringify(process.env.npm_package_version);
console.log('Current version: ' + VERSION);
const webpackConfig = {
context: path.resolve(__dirname, '../src'),
entry: {
'cld-video-player': {
import: './index.umd.js',
library: { name: 'cloudinary-video-player', type: 'umd' }
},
'cld-video-player-lazy': {
import: './index.lazy.js',
library: { name: 'cloudinary-video-player', type: 'umd' }
}
},
output: {
filename: `[name]${minFilenamePart}.js`,
chunkFilename: `[name]${minFilenamePart}.js`,
path: path.resolve(__dirname, '../dist'),
publicPath: 'auto',
chunkLoadingGlobal: 'cloudinaryVideoPlayerChunkLoading'
},
optimization: {
splitChunks: {
cacheGroups: {
defaultVendors: false,
styles: {
name: 'styles',
type: 'css/mini-extract',
chunks: 'all',
enforce: true
}
}
}
},
resolve: {
extensions: ['.js', '.scss'],
modules: ['node_modules'],
alias: {
'~': path.resolve(__dirname, '../src'),
'video.js': path.resolve(__dirname, '../node_modules/video.js/dist/alt/video.core.js'),
'video.root.js': path.resolve(__dirname, '../node_modules/video.js')
}
},
module: {
rules: [
{
test: /\.js$/,
exclude: [/node_modules/],
use: [
{
loader: 'babel-loader'
},
'webpack-conditional-loader'
]
},
{
test: /\.s?css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'sass-loader',
options: {
sassOptions: {
charset: false
}
}
}
],
},
{
test: /\.svg/,
type: 'asset/inline'
},
{
test: path.resolve(__dirname, '../node_modules/video.js'),
loader: 'expose-loader',
options: {
exposes: {
globalName: 'videojs',
override: true
}
}
}
]
},
plugins: [
new ESLintPlugin(),
new DefinePlugin({ VERSION }),
new MiniCssExtractPlugin({
filename: `cld-video-player${minFilenamePart}.css`
})
]
};
module.exports = webpackConfig;