Chore: Revert externalization of the tslib so it gets bundled with plugins. (#43556)

* Revert externalization of the tslib so it gets bundled with the plugins.

* Adding pnp-webpack-plugin to properly resolve dependencies in nested plugins.

* added dependency on lodash.
This commit is contained in:
Marcus Andersson 2021-12-30 08:53:42 +01:00 committed by GitHub
parent f17fb76b5e
commit efd7a12686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 3 deletions

View File

@ -171,7 +171,6 @@ const getBaseWebpackConfig: WebpackConfigurationGetter = async (options) => {
performance: { hints: false },
externals: [
'tslib',
'lodash',
'jquery',
'moment',

View File

@ -16,7 +16,10 @@
"author": "Grafana Labs",
"devDependencies": {
"@types/jest": "26.0.15",
"@types/lodash": "4.14.149",
"@types/react": "17.0.30",
"lodash": "4.17.21",
"pnp-webpack-plugin": "^1.7.0",
"ts-loader": "8.0.11",
"webpack": "5.58.1"
},

View File

@ -0,0 +1,15 @@
const { merge } = require('lodash');
const PnpWebpackPlugin = require('pnp-webpack-plugin');
module.exports = {
getWebpackConfig: (baseConfig) => {
return merge(baseConfig, {
resolve: {
plugins: [PnpWebpackPlugin],
},
resolveLoader: {
plugins: [PnpWebpackPlugin.moduleLoader(module)],
},
});
},
};

View File

@ -5,7 +5,6 @@ import kbn from 'app/core/utils/kbn';
import moment from 'moment'; // eslint-disable-line no-restricted-imports
import angular from 'angular';
import jquery from 'jquery';
import * as tslib from 'tslib';
// Experimental module exports
import prismjs from 'prismjs';
@ -82,7 +81,6 @@ function exposeToPlugin(name: string, component: any) {
});
}
exposeToPlugin('tslib', tslib);
exposeToPlugin('@grafana/data', grafanaData);
exposeToPlugin('@grafana/ui', grafanaUI);
exposeToPlugin('@grafana/runtime', grafanaRuntime);

View File

@ -3383,8 +3383,11 @@ __metadata:
"@grafana/toolkit": 8.4.0-pre
"@grafana/ui": 8.4.0-pre
"@types/jest": 26.0.15
"@types/lodash": 4.14.149
"@types/react": 17.0.30
jquery: 3.5.1
lodash: 4.17.21
pnp-webpack-plugin: ^1.7.0
react: 17.0.1
react-dom: 17.0.1
react-hook-form: 7.5.3
@ -27099,6 +27102,15 @@ __metadata:
languageName: node
linkType: hard
"pnp-webpack-plugin@npm:^1.7.0":
version: 1.7.0
resolution: "pnp-webpack-plugin@npm:1.7.0"
dependencies:
ts-pnp: ^1.1.6
checksum: a41716d13607be5a3e06ba58b17e9e619cf07da3a0a7b10bd41cd89362873041054fd2b7966ad30a1b26b826cfb8fecc0469a95902d5b1b8ba8f591e2fe6b96d
languageName: node
linkType: hard
"pofile@npm:^1.1.0":
version: 1.1.1
resolution: "pofile@npm:1.1.1"