-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.prod.ts
More file actions
47 lines (42 loc) · 1.3 KB
/
webpack.prod.ts
File metadata and controls
47 lines (42 loc) · 1.3 KB
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
import projectConfig from './project.config';
import merge from 'webpack-merge';
import baseWebpackConfig from './webpack.base';
import { Plugin } from 'webpack';
import CopyWebpackPlugin from 'copy-webpack-plugin';
const DtsBundleWebpack: IDtsBundleWebpack = require('dts-bundle-webpack');
// types for DtsBundleWebpack
interface IDtsBundleWebpack {
new (options: { name: string; main: string; baseDir?: string; out?: string }): Plugin;
}
const webpackConfig = merge(baseWebpackConfig, {
mode: 'production',
// webpack——devtool里的7种SourceMap模式
// https://www.cnblogs.com/wangyingblog/p/7027540.html
devtool: 'cheap-module-source-map',
plugins: [
new CopyWebpackPlugin([
{
from: './example/',
to: './'
}
]),
new DtsBundleWebpack({
name: projectConfig.moduleName,
main: 'build/type/index.d.ts',
baseDir: 'build',
out: projectConfig.moduleName + '.d.ts'
})
],
optimization: {
splitChunks: {
cacheGroups: {
commons: {
name: 'commons',
chunks: 'initial',
minChunks: 2
}
}
}
}
});
module.exports = webpackConfig;