Grafana UI: Fix nonexistent indexof module for plugin tests (#50529)

* fix(grafana-ui): prevent module resolution failure where component-indexof appears as indexof

* chore(grafana-ui): update comment explaining need for alias plugin
This commit is contained in:
Jack Westbrook
2022-06-10 10:37:40 +02:00
committed by GitHub
parent bda47df4ad
commit 6a4906ef7e
3 changed files with 37 additions and 2 deletions
+2
View File
@@ -97,6 +97,7 @@
"@babel/core": "7.18.2",
"@grafana/tsconfig": "^1.2.0-rc1",
"@mdx-js/react": "1.6.22",
"@rollup/plugin-alias": "^3.1.9",
"@rollup/plugin-commonjs": "22.0.0",
"@rollup/plugin-node-resolve": "13.3.0",
"@storybook/addon-a11y": "6.4.21",
@@ -169,6 +170,7 @@
"rollup-plugin-sourcemaps": "0.6.3",
"rollup-plugin-svg-import": "^1.6.0",
"rollup-plugin-terser": "7.0.2",
"rollup-plugin-visualizer": "^5.6.0",
"sass-loader": "13.0.0",
"storybook-dark-mode": "1.1.0",
"style-loader": "3.3.1",
+5 -1
View File
@@ -1,3 +1,4 @@
import alias from '@rollup/plugin-alias';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import svg from 'rollup-plugin-svg-import';
@@ -39,6 +40,9 @@ const buildCjsPackage = ({ env }) => {
'@emotion/css',
],
plugins: [
// rc-time-picker has a transitive dependency on component-indexof which
// when bundled via `component-classes` imports a nonexistent `indexof` module.
alias({ entries: [{ find: 'indexof', replacement: 'component-indexof' }] }),
commonjs({
include: /node_modules/,
ignoreTryCatch: false,
@@ -49,4 +53,4 @@ const buildCjsPackage = ({ env }) => {
],
};
};
export default [buildCjsPackage({ env: 'development' }), buildCjsPackage({ env: 'production' })];
export default [buildCjsPackage({ env: 'development' })];