Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not build #14

Open
antifuchs opened this issue Oct 11, 2024 · 0 comments · May be fixed by #15
Open

Does not build #14

antifuchs opened this issue Oct 11, 2024 · 0 comments · May be fixed by #15

Comments

@antifuchs
Copy link

Running npm run build results in the following errors:

:;    npm run build

> [email protected] build
> webpack -c ./.config/webpack/webpack.config.ts --env production

assets by status 73.7 KiB [cached] 6 assets
orphan modules 60.5 KiB [orphan] 16 modules
runtime modules 937 bytes 4 modules
built modules 52.3 KiB [built]
  modules by path external "@grafana/ 126 bytes
    external "@grafana/data" 42 bytes [built] [code generated]
    external "@grafana/runtime" 42 bytes [built] [code generated]
    external "@grafana/ui" 42 bytes [built] [code generated]
  cacheable modules 52 KiB
    ./module.ts + 9 modules 51.9 KiB [built] [code generated]
    ./components/QueryEditor.tsx 39 bytes [built] [code generated] [1 error]
  external "lodash" 42 bytes [built] [code generated]
  external "react" 42 bytes [built] [code generated]
  external "@emotion/css" 42 bytes [built] [code generated]
  external "rxjs" 42 bytes [built] [code generated]

ERROR in ./components/QueryEditor.tsx
Module build failed (from ../node_modules/swc-loader/src/index.js):
Error:
  × the name `isInDashboard` is defined multiple times
    ╭─[/Users/asf/Hacks/openobserve-grafana-plugin/src/components/QueryEditor.tsx:18:1]
 18 │   const [isMounted, setIsMounted]: any = useState(false);
 19 │   const [isLoading, setIsLoading]: any = useState([]);
 20 │
 21 │   const isInDashboard = useMemo(() => app === 'panel-editor', [app]);
    ·         ──────┬──────
    ·               ╰── previous definition of `isInDashboard` here
 22 │
 23 │   const getTimeStampColumnName = () => {
 24 │     return datasource.instanceSettings?.jsonData?.timestamp_column || '_timestamp';
 25 │   };
 26 │
 27 │   const startLoading = () => {
 28 │     setIsLoading([...isLoading, true]);
 29 │   };
 30 │
 31 │   const stopLoading = () => {
 32 │     setIsLoading(isLoading.slice(1));
 33 │   };
 34 │
 35 │   const isInDashboard = useMemo(() => app === 'panel-editor', [app]);
    ·         ──────┬──────
    ·               ╰── `isInDashboard` redefined here
 36 │
 37 │   const getTimeStampColumnName = () => {
 38 │     return datasource.instanceSettings?.jsonData?.timestamp_column || '_timestamp';
    ╰────

  × the name `getTimeStampColumnName` is defined multiple times
    ╭─[/Users/asf/Hacks/openobserve-grafana-plugin/src/components/QueryEditor.tsx:20:1]
 20 │
 21 │   const isInDashboard = useMemo(() => app === 'panel-editor', [app]);
 22 │
 23 │   const getTimeStampColumnName = () => {
    ·         ───────────┬──────────
    ·                    ╰── previous definition of `getTimeStampColumnName` here
 24 │     return datasource.instanceSettings?.jsonData?.timestamp_column || '_timestamp';
 25 │   };
 26 │
 27 │   const startLoading = () => {
 28 │     setIsLoading([...isLoading, true]);
 29 │   };
 30 │
 31 │   const stopLoading = () => {
 32 │     setIsLoading(isLoading.slice(1));
 33 │   };
 34 │
 35 │   const isInDashboard = useMemo(() => app === 'panel-editor', [app]);
 36 │
 37 │   const getTimeStampColumnName = () => {
    ·         ───────────┬──────────
    ·                    ╰── `getTimeStampColumnName` redefined here
 38 │     return datasource.instanceSettings?.jsonData?.timestamp_column || '_timestamp';
 39 │   };
    ╰────
 @ ./module.ts 4:0-55 6:100-111

ERROR in [eslint]
/Users/asf/Hacks/openobserve-grafana-plugin/src/components/QueryEditor.tsx
  35:9  error  'isInDashboard' is already defined           no-redeclare
  37:9  error  'getTimeStampColumnName' is already defined  no-redeclare

✖ 2 problems (2 errors, 0 warnings)


ERROR in ./src/components/QueryEditor.tsx:21:9
TS2451: Cannot redeclare block-scoped variable 'isInDashboard'.
    19 |   const [isLoading, setIsLoading]: any = useState([]);
    20 |
  > 21 |   const isInDashboard = useMemo(() => app === 'panel-editor', [app]);
       |         ^^^^^^^^^^^^^
    22 |
    23 |   const getTimeStampColumnName = () => {
    24 |     return datasource.instanceSettings?.jsonData?.timestamp_column || '_timestamp';

ERROR in ./src/components/QueryEditor.tsx:23:9
TS2451: Cannot redeclare block-scoped variable 'getTimeStampColumnName'.
    21 |   const isInDashboard = useMemo(() => app === 'panel-editor', [app]);
    22 |
  > 23 |   const getTimeStampColumnName = () => {
       |         ^^^^^^^^^^^^^^^^^^^^^^
    24 |     return datasource.instanceSettings?.jsonData?.timestamp_column || '_timestamp';
    25 |   };
    26 |

ERROR in ./src/components/QueryEditor.tsx:35:9
TS2451: Cannot redeclare block-scoped variable 'isInDashboard'.
    33 |   };
    34 |
  > 35 |   const isInDashboard = useMemo(() => app === 'panel-editor', [app]);
       |         ^^^^^^^^^^^^^
    36 |
    37 |   const getTimeStampColumnName = () => {
    38 |     return datasource.instanceSettings?.jsonData?.timestamp_column || '_timestamp';

ERROR in ./src/components/QueryEditor.tsx:37:9
TS2451: Cannot redeclare block-scoped variable 'getTimeStampColumnName'.
    35 |   const isInDashboard = useMemo(() => app === 'panel-editor', [app]);
    36 |
  > 37 |   const getTimeStampColumnName = () => {
       |         ^^^^^^^^^^^^^^^^^^^^^^
    38 |     return datasource.instanceSettings?.jsonData?.timestamp_column || '_timestamp';
    39 |   };
    40 |

webpack 5.89.0 compiled with 6 errors in 2970 ms

These all look like typescript validation errors. You can find them in the github workflow runs for this repo also: https://github.com/openobserve/openobserve-grafana-plugin/actions/runs/11063607629/job/30740000196

jealouscloud added a commit to jealouscloud/openobserve-grafana-plugin-fixes that referenced this issue Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant