-
Notifications
You must be signed in to change notification settings - Fork 0
/
.umirc.js
63 lines (62 loc) · 1.52 KB
/
.umirc.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
//ref: https://umijs.org/config/
import { join } from 'path'
import fs from 'fs'
export default {
history: 'browser',
sass: {},
theme: 'src/theme.js',
plugins: [
// ref: https://umijs.org/plugin/umi-plugin-react.html
[
'umi-plugin-react',
{
locale: {
enable: true,
default: 'en-US',
baseNavigator: true,
antd: true,
},
antd: true,
dva: {
hmr: true,
},
dynamicImport: {
loadingComponent: 'components/LayoutComponents/Loader',
},
pwa: {
manifestOptions: {
srcPath: '.pwa.json',
},
workboxPluginMode: 'InjectManifest',
workboxOptions: {
swSrc: './service-worker.js',
},
},
},
],
'./scripts/get-config.js',
'./umi-plugins/entry.js',
'./umi-plugins/versioning.js',
'./umi-plugins/configuration.js',
],
define: {
Environment: 'int',
Account: 'test',
RedirectUrl: 'http://localhost:8000/azure',
},
devServer: {
before: function(app, server) {
app.get('/docs/:docId.pdf', function(req, res) {
const { docId } = req.params
const file = join(__dirname, `./etc/static_data/docs/${docId}.pdf`)
try {
var data = fs.readFileSync(file)
res.contentType('application/pdf')
res.send(data) // Set disposition and send it.
} catch {
res.send('<html>404 PDF NOT EXIST</html>')
}
})
},
},
}