OSDN Git Service

update the port retry logic
[bytom/bytom-electron.git] / webpack / webpack.dll.js
1 // Original from https://github.com/mxstbr/react-boilerplate/
2
3 /*eslint-env node*/
4
5 /**
6  * WEBPACK DLL GENERATOR
7  *
8  * This profile is used to cache webpack's module
9  * contexts for external library and framework type
10  * dependencies which will usually not change often enough
11  * to warrant building them from scratch every time we use
12  * the webpack process.
13  */
14
15 const { join } = require('path')
16 const webpack = require('webpack')
17 const pkg = require(join(process.cwd(), 'package.json'))
18
19 const outputPath = join(process.cwd(), 'node_modules/dashboard-dlls')
20
21 const dllException = ['log4js', 'electron-settings', 'glob', 'toml']
22
23 const config = require('./webpack.base')({
24   context: process.cwd(),
25   entry: {dependencies: Object.keys(pkg.dependencies).filter(dependency => !dllException.includes(dependency))},
26   devtool: 'eval',
27   output: {
28     filename: '[name].dll.js',
29     path: outputPath,
30     library: '[name]',
31   },
32   plugins: [
33     new webpack.DllPlugin({
34       name: '[name]',
35       path: join(outputPath, 'manifest.json')
36     }),
37   ],
38 })
39
40 module.exports = config