Hi,folks.
I want to develop a plugin base on the official table panel plugin, so I copy it into /data/plugin/my-plugin-panel/src.And copy Gruntfile from a example plugin piechart panel. The example’s module file is *.js,but official module file is *.ts.After I complie the plugin by grunt. I get a error ’ Plugin Error Fetch error: 404 Not Found Instantiating localhost:3000/public/plugin/my-plugin-panel/module.js’…
How can I solve it? Can I change the module.js to module.ts? Or maybe change plugin loading method?
My OS is Win10
You cannot compile a typescript plugin using the Gruntfile of a javascript plugin. The dependencies are different. Also, you can change module.ts to module.js, however you’ll get a few syntax errors. Try removing all variable declarations that look like this
variablename: variable_type;
and replace them with
var variablename; or var variablename = [];
as is appropriate according to the original definition.
I don’t know much about typescript or panel plugins but this my guess
Well, I saw the Ajax plugin is compling typescript, by ryantxu,using the Gruntfile.js…so I guess some way to do it,too
I said you couldn’t do it using the Gruntfile of a js plugin. If you use the Gruntfile of a ts plugin it might work. The reason being that there are different dependencies for ts and js. I haven’t tried it before but this might help
https://github.com/grafana/typescript-template-datasource
https://localhost:3000/t/develop-plugins-with-typescript/1173
I use a template from github,thanks