Skip to content

Commit 9b804f4

Browse files
silverwindlafrikstechknowlogick
authored
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 <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent d461591 commit 9b804f4

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

package-lock.json

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"@babel/runtime": "7.11.2",
1212
"@claviska/jquery-minicolors": "2.3.5",
1313
"@primer/octicons": "10.0.0",
14+
"add-asset-webpack-plugin": "1.0.0",
1415
"babel-loader": "8.1.0",
1516
"clipboard": "2.0.6",
1617
"core-js": "3.6.5",

webpack.config.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const fastGlob = require('fast-glob');
22
const wrapAnsi = require('wrap-ansi');
3+
const AddAssetPlugin = require('add-asset-webpack-plugin');
34
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
45
const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries');
56
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
@@ -273,14 +274,17 @@ module.exports = {
273274
new MonacoWebpackPlugin({
274275
filename: 'js/monaco-[name].worker.js',
275276
}),
276-
new LicenseWebpackPlugin({
277+
isProduction ? new LicenseWebpackPlugin({
277278
outputFilename: 'js/licenses.txt',
278279
perChunkOutput: false,
279280
addBanner: false,
280281
skipChildCompilers: true,
281282
modulesDirectories: [
282283
resolve(__dirname, 'node_modules'),
283284
],
285+
additionalModules: [
286+
'@primer/octicons',
287+
].map((name) => ({name, directory: resolve(__dirname, `node_modules/${name}`)})),
284288
renderLicenses: (modules) => {
285289
const line = '-'.repeat(80);
286290
return modules.map((module) => {
@@ -294,7 +298,7 @@ module.exports = {
294298
warnings: false,
295299
errors: true,
296300
},
297-
}),
301+
}) : new AddAssetPlugin('js/licenses.txt', `Licenses are disabled during development`),
298302
],
299303
performance: {
300304
hints: false,

0 commit comments

Comments
 (0)