Build: Introduce webpack manifest plugin (#49798)

* build(webpack): introduce manifest plugin

* build(webpack): move manifest.json to root of project and git ignore
This commit is contained in:
Jack Westbrook 2022-08-30 11:18:55 +02:00 committed by GitHub
parent ef32050508
commit 5ea01dc9b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 1 deletions

3
.gitignore vendored
View File

@ -129,6 +129,9 @@ pkg/cmd/grafana-server/__debug_bin
## CI places the packages in a different location
/npm-artifacts/*.tgz
# Ignore frontend build manifest
manifest.json
# Ignore go local build dependencies
/scripts/go/bin/**

View File

@ -243,6 +243,7 @@
"webpack-bundle-analyzer": "4.5.0",
"webpack-cli": "4.10.0",
"webpack-dev-server": "4.9.3",
"webpack-manifest-plugin": "5.0.0",
"webpack-merge": "5.8.0"
},
"dependencies": {

View File

@ -5,6 +5,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
const { merge } = require('webpack-merge');
const HTMLWebpackCSSChunks = require('./plugins/HTMLWebpackCSSChunks');
@ -81,6 +82,10 @@ module.exports = (env = {}) =>
chunksSortMode: 'none',
}),
new HTMLWebpackCSSChunks(),
new WebpackManifestPlugin({
fileName: path.join(process.cwd(), 'manifest.json'),
filter: (file) => !file.name.endsWith('.map'),
}),
function () {
this.hooks.done.tap('Done', function (stats) {
if (stats.compilation.errors && stats.compilation.errors.length) {

View File

@ -22056,6 +22056,7 @@ __metadata:
webpack-bundle-analyzer: 4.5.0
webpack-cli: 4.10.0
webpack-dev-server: 4.9.3
webpack-manifest-plugin: 5.0.0
webpack-merge: 5.8.0
whatwg-fetch: 3.6.2
languageName: unknown
@ -34722,7 +34723,7 @@ __metadata:
languageName: node
linkType: hard
"source-list-map@npm:^2.0.0":
"source-list-map@npm:^2.0.0, source-list-map@npm:^2.0.1":
version: 2.0.1
resolution: "source-list-map@npm:2.0.1"
checksum: 806efc6f75e7cd31e4815e7a3aaf75a45c704871ea4075cb2eb49882c6fca28998f44fc5ac91adb6de03b2882ee6fb02f951fdc85e6a22b338c32bfe19557938
@ -37973,6 +37974,18 @@ __metadata:
languageName: node
linkType: hard
"webpack-manifest-plugin@npm:5.0.0":
version: 5.0.0
resolution: "webpack-manifest-plugin@npm:5.0.0"
dependencies:
tapable: ^2.0.0
webpack-sources: ^2.2.0
peerDependencies:
webpack: ^5.47.0
checksum: 864d68f90870e194074756e71caf3df36b777d687a50286ba27eb1958480642b125c2cf47a2787beac52eba4b1ccf1fe8141f017c81f1e87e953481f852a7c48
languageName: node
linkType: hard
"webpack-merge@npm:5.8.0, webpack-merge@npm:^5.7.3":
version: 5.8.0
resolution: "webpack-merge@npm:5.8.0"
@ -37993,6 +38006,16 @@ __metadata:
languageName: node
linkType: hard
"webpack-sources@npm:^2.2.0":
version: 2.3.1
resolution: "webpack-sources@npm:2.3.1"
dependencies:
source-list-map: ^2.0.1
source-map: ^0.6.1
checksum: 6fd67f2274a84c5f51ad89767112ec8b47727134bf0f2ba0cff458c970f18966939a24128bdbddba621cd66eeb2bef0552642a9333cd8e54514f7b2a71776346
languageName: node
linkType: hard
"webpack-sources@npm:^3.2.3":
version: 3.2.3
resolution: "webpack-sources@npm:3.2.3"