-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
54 lines (51 loc) · 1.26 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
const path = require('path');
const packageinfo = require("read-pkg-up").sync().package;
const camelCase = require("camelcase");
module.exports = {
entry: './src/index.ts',
output: {
path: path.resolve(path.join(__dirname, '.', 'dist')),
filename: 'mui-form-fields.js',
library: 'MuiFormFields',
libraryTarget: 'umd',
globalObject: 'this',
},
module: {
rules: [
{
test: /\.js$/,
use: ['babel-loader', 'source-map-loader'],
exclude: /node_modules/,
},
{
test: /\.(tsx|ts)?$/,
use: [
'babel-loader',
'awesome-typescript-loader',
'react-docgen-typescript-loader',
],
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
modules: [
path.join(__dirname, 'src'),
path.join(__dirname, 'node_modules'),
],
},
externals: Object.keys(packageinfo.peerDependencies).map(k => {
// Aliases for some specific libs
const root = {
moment: "moment",
}[k] || camelCase(k.replace("@material-ui/", ""), {pascalCase: true});
return {
[k]: {
root: camelCase(k.replace("@material-ui/", ""), {pascalCase: true}),
amd: k,
commonjs: k,
commonjs2: k,
},
}
}),
};