-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
72 lines (70 loc) · 1.95 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// @flow
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HTMLPlugin = require('html-webpack-plugin');
dev = process.env.NODE_ENV !== 'production';
module.exports = {
mode: dev ? 'development' : 'production',
context: __dirname,
entry: {
index: dev ? './dev/index.js' : './src/index.js',
},
output: {
filename: '[name].js',
library: 'persian-katex-plugin',
libraryTarget: 'umd',
libraryExport: 'default',
globalObject: 'this',
path: path.resolve(__dirname, 'build'),
publicPath: dev ? '/' : ''
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader',
}),
},
{
test: /\.less$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
'css-loader',
'less-loader',
],
}),
},
{
test: /\.(ttf|woff|woff2)$/,
use: [{
loader: 'file-loader',
options: {
name: 'fonts/[name].[ext]',
},
}],
},
],
},
plugins: [
new ExtractTextPlugin({
filename: '[name].css',
disable: dev,
}),
].filter(Boolean),
devtool: dev && 'inline-source-map',
devServer: {
contentBase: [ path.join(__dirname, 'build'), __dirname ],
disableHostCheck: true,
host: '0.0.0.0',
port: 7940,
stats: { colors: true },
}
};