diff options
author | silverwind | 2020-08-22 03:23:03 +0200 |
---|---|---|
committer | GitHub | 2020-08-21 21:23:03 -0400 |
commit | 9b804f4ed46c22a0859fc1646ef1a40b694c6f88 (patch) | |
tree | c75650c0813f61fd909b82d56ddeed1e6811a2d9 /webpack.config.js | |
parent | d461591aacce94bffca50bf486a1e3a679459bea (diff) |
Speed up licenses.txt build during development, add additionalModules (#12510)
- Emit static string for licenses.txt during development for faster builds
- Manually add @primer/octicons to licenses.txt because it's never
directy imported.
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'webpack.config.js')
-rw-r--r-- | webpack.config.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/webpack.config.js b/webpack.config.js index d7f0c83d8..9a69c550f 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,6 @@ const fastGlob = require('fast-glob'); const wrapAnsi = require('wrap-ansi'); +const AddAssetPlugin = require('add-asset-webpack-plugin'); const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); @@ -273,7 +274,7 @@ module.exports = { new MonacoWebpackPlugin({ filename: 'js/monaco-[name].worker.js', }), - new LicenseWebpackPlugin({ + isProduction ? new LicenseWebpackPlugin({ outputFilename: 'js/licenses.txt', perChunkOutput: false, addBanner: false, @@ -281,6 +282,9 @@ module.exports = { modulesDirectories: [ resolve(__dirname, 'node_modules'), ], + additionalModules: [ + '@primer/octicons', + ].map((name) => ({name, directory: resolve(__dirname, `node_modules/${name}`)})), renderLicenses: (modules) => { const line = '-'.repeat(80); return modules.map((module) => { @@ -294,7 +298,7 @@ module.exports = { warnings: false, errors: true, }, - }), + }) : new AddAssetPlugin('js/licenses.txt', `Licenses are disabled during development`), ], performance: { hints: false, |