-
Notifications
You must be signed in to change notification settings - Fork 44
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
import your library in angularJS #60
Comments
Is there any workaround? Like instead of npm installing the package, may I include it from /lib? |
hi @Jiajun-Deng - thanks for your interest in state-machine-cat. My knowledge about angular/ angularjs (or any other FE framework for that matter ...) is quite sporadic - and my knowledge on systemjs is even less, so I might not be the best person in the world to help you with this. Seeing the errors, state-machine-cat isn't the most likely culprit either.
That said: the three error messages in your screen shot have this in common:
With its default configuration webpack will include these in the bundle wholesale. That's what's e.g. happening when it creates the bundle for https://state-machine-cat.js.org. Assuming you bundle your app with webpack, that's what should be happening in your case too. The error message is from system.js (which grafana seems to use for loading plugins), though, which suggests that it's not looking at a webpack bundled thing or your actual bundling works differently... If you start asking for help in other communities (grafana? systemjs? webpack?) it might be useful to include a few more details about your setup. How do you bundle? What does your webpack config look like? What's actually loaded in the browser? In what shape (bundled, loose files) do you serve your files? How does grafana's plug in system load your . Some other stuff I've found that might be of help
HTH ... |
Hi, @sverweij .Thank you for your reply.
|
I've tried using system.js & the |
The libraryTarget of my plugin is 'amd'. I've checked other grafana plugins, they seem to have the same target. So I think amd is required by the grafana API schema? |
It doesn't seem likely. That said I have expertise in grafana nor (as said before) in AngularJS
no. but as I mentioned in the first reply, there is in viz.js
Correct. which is why you use something like webpack, which makes sure the functionality in these packages get bundled with the app you're building. E.g. on state-machine-cat.js.org it does work...
I'm closing this issue as there's no indication the issue you're facing is caused by state-machine-cat (a.o.t. a configuration struggle with systemjs, webpack, grafana). Feel free to re-open if you have concrete evenidence to the contrary. |
Thanks for your reply. |
I want to import your API to visualize the state machine. But once I add:
const smcat = require("state-machine-cat");
My code will be built successfully while cant generate a working bundled js file.
Context
I tried
import * as smcat from 'state-machine-cat'
still the same situation.
I use webpack to build it, into AMD libraryTarget.
Also, I use npm.
The text was updated successfully, but these errors were encountered: