-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathnwb.config.js
43 lines (39 loc) · 921 Bytes
/
nwb.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
const fs = require('fs')
const path = require('path')
module.exports = () => ({
type: 'react-component',
npm: {
esModules: false,
umd: {
entry: './src/umd.ts',
global: 'widgetbot'
}
},
webpack: {
extra: {
resolve: {
extensions: ['.ts', '.tsx', '.js']
}
},
config(config) {
config.module.rules.push({
test: /\.tsx?$/,
use: [
{
loader: 'babel-loader',
options: JSON.parse(
fs.readFileSync(path.join(__dirname, 'dev.babelrc'), 'utf8')
)
},
'ts-loader'
]
})
config.entry = config.entry.map(
path => (path.endsWith('index.js') ? path.replace(/js$/, 'ts') : path)
)
const outputDirs = config.output.filename.split('/')
config.output.filename = outputDirs[outputDirs.length - 1]
return config
}
}
})