Chore: webpack alias react and grafana-runtime to share singletons (#81789)

* Chore: webpack alias react and grafana-runtime to share singletons

* Move alias to dev webpack, add alias for grafana-data as well

* remove whitespace
This commit is contained in:
Josh Hunt 2024-02-05 16:25:19 +00:00 committed by GitHub
parent 7852ea012d
commit 57993f65ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -35,6 +35,18 @@ module.exports = (env = {}) => {
ignored: /node_modules/,
},
resolve: {
alias: {
// Packages linked for development need react to be resolved from the same location
react: require.resolve('react'),
// Also Grafana packages need to be resolved from the same location so they share
// the same singletons
'@grafana/runtime': path.resolve(__dirname, '../../packages/grafana-runtime'),
'@grafana/data': path.resolve(__dirname, '../../packages/grafana-data'),
},
},
module: {
// Note: order is bottom-to-top and/or right-to-left
rules: [