2

I am currently in the process of creating a new panel plugin by following the tutorial located here: Create Plugin and here Build your first plugin.

Steps I followed in accordance with the tutorial:

npm init @grafana/plugin

selected panel type, name, description and so on...

npm i

npm run dev

I got an error by npm run dev:

ERROR in ./module.ts
Module build failed (from ../node_modules/swc-loader/src/index.js):
Error: failed to handle: base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.

webpack 5.88.2 compiled with 1 error in 330 ms
Type-checking in progress...
thread '<unnamed>' panicked at 'base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.', /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_module-0.173.28/src/path.rs:104:13
assets by status 17.1 KiB [cached] 6 assets
./module.ts 39 bytes [built] [1 error]

ERROR in ./module.ts
Module build failed (from ../node_modules/swc-loader/src/index.js):
Error: failed to handle: base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.

Can someone provide assistance? I expected it to work smoothly since the instructions are directly from Grafana, and I am following the prescribed steps. Any help would be greatly appreciated!

Cheers, Marcelo

Turtles
  • 234
  • 3
  • 13

1 Answers1

2

There's an open issue in grafana/plugin-tools related to this bug.

The @swc/core is bugged in version 1.3.76 (there's a fix that has been merged but not released yet).

On my side downgrading this package to 1.3.75 fixed this error

In the package.json you can downgrade the @swc/core to version to 1.3.75 like this:

"@swc/core": "1.3.75"

And run a yarn install again

Airclo
  • 31
  • 3