-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.umd.js
99 lines (94 loc) · 2 KB
/
webpack.umd.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
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import CopyPlugin from 'copy-webpack-plugin'
import {distPath} from './helper.js'
export let common = {
entry:{
"quill-emoji": './src/quill-emoji.js'
},
resolve: {
extensions: ['.ts', '.js'],
fullySpecified:false
},
output: {
filename: 'quill-emoji.js',
path: distPath,
clean: true,
library:{
name:"WMLQuillEmoji",
type:"umd",
export: 'default',
},
// globalObject: 'this',
},
target: 'web',
externals: {
quill:"Quill",
},
plugins: [
new MiniCssExtractPlugin({
filename: 'quill-emoji.css',
chunkFilename: '[name].css',
}),
new CopyPlugin({
patterns: [
{
from: 'package.json',
to: 'package.json',
transform: (content, path) => {
const packageJson = JSON.parse(content.toString());
packageJson.main = 'quill-emoji.js';
delete packageJson.scripts;
delete packageJson.devDependencies;
return JSON.stringify(packageJson, null, 2);
}
},
{
from:'README.md',
to:'README.md'
},
{
from:'LICENSE',
to:'LICENSE',
toType: 'file'
}
],
})
],
module: {
rules: [
{
test: /\.(scss|css)$/i,
use: [
MiniCssExtractPlugin.loader,
// 'style-loader',
'css-loader',
'sass-loader'
]
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource',
},
// {
// test: /\.js$/,
// enforce: 'pre',
// use: ['source-map-loader']
// },
{
test: /\.js$/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
],
exclude: /node_modules/,
resolve: {
fullySpecified: false
}
}
]
}
};