-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
70 lines (69 loc) · 1.93 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
const path = require("path")
const UglifyJsPlugin = require("uglifyjs-webpack-plugin")
const nodeExternals = require('webpack-node-externals');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
devtool: "source-map",
mode: "production",
entry: {
'sce-sim-grid': './src/index.ts',
// 'sce-sim-grid.min': './src/index.ts'
},
output: {
path: path.resolve(__dirname, 'lib-umd'),
filename: "[name].js",
library: "sceSimGrid",
libraryTarget: "umd",
umdNamedDefine: true
},
resolve: {
extensions: ['.ts', '.tsx', '.js']
},
externals: [nodeExternals()],
// expect consumer to have these dependencies
// externals: {
// react: 'react',
// reactDOM: 'react-dom',
// reactCore: '@patternfly/react-core',
// reactIcons: '@patternfly/react-icons',
// reactExperimental: '@patternfly/react-core/dist/js/experimental'
// },
// optimization: {
// minimizer: [
// new UglifyJsPlugin({
// test: /min\.js(\?.*)?$/i,
// sourceMap: true
// }),
// ],
// },
module: {
rules: [
{
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
},
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, 'css-loader']
},
{
test: /\.(jpg|jpeg|png|gif)$/i,
include: [
path.resolve(__dirname, "./node_modules/@patternfly/patternfly/assets"),
path.resolve(__dirname, "./node_modules/@patternfly/react-core/dist/styles/assets/images"),
path.resolve(__dirname, "./node_modules/@patternfly/react-styles/css/assets/images"),
path.resolve(__dirname, "./node_modules/@patternfly/react-core/node_modules/@patternfly/react-styles/css/assets/images")
],
use: ["file-loader"]
}
],
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
})
],
}