-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.ts
49 lines (42 loc) · 1.22 KB
/
webpack.prod.ts
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
import projectConfig from './project.config'
import merge from 'webpack-merge'
import base from './webpack.base'
import webpack from 'webpack';
import { Plugin } from 'webpack';
const DtsBundleWebpack: IDtsBundleWebpack = require('dts-bundle-webpack')
// types for DtsBundleWebpack
interface IDtsBundleWebpack {
new(options: {
name: string,
main: string,
baseDir?: string,
out?: string
}): Plugin
}
const config: webpack.Configuration = {
mode: 'production',
// webpack——devtool里的7种SourceMap模式
// https://www.cnblogs.com/wangyingblog/p/7027540.html
devtool: 'cheap-module-source-map'
}
const webConfig = merge(base.webConfig, config, {
plugins: [
new DtsBundleWebpack({
name: projectConfig.moduleName,
main: 'build/type/index.d.ts',
baseDir: 'build/web',
out: 'index.d.ts'
}),
]
});
const nodeConfig = merge(base.nodeConfig, config, {
plugins: [
new DtsBundleWebpack({
name: projectConfig.moduleName,
main: 'build/type/index.d.ts',
baseDir: 'build/node',
out: 'index.d.ts'
}),
]
});
module.exports = [webConfig, nodeConfig];