Closed gmlloves closed 1 year ago
Yes, I saw this message. It is related to this line where there is the word export function
. If I remove the export
the script is not working.
I don't know why this is a syntax error.
It happens because the export directive is for modules and not for plain Javascript.
Add at the end of the page the following scripts:
<script src="_content/PSC.Blazor.Components.Chartjs/lib/Chart.js/chart.js"></script> <script src="_content/PSC.Blazor.Components.Chartjs/Chart.js"></script>
The is imported from:
public ChartJsInterop(IJSRuntime jsRuntime)
{
moduleTask = new(() => jsRuntime.InvokeAsync<IJSObjectReference>("import",
"./_content/PSC.Blazor.Components.Chartjs/Chart.js").AsTask());
}
I removed it from my index.html and the error does not happen anymore (It works for me).
Thank you so much!
Hi,
We are still seeing the same error on line 46 using version:
Was @gmlloves suggestion above incorporated in a later release or I am missing something in the suggested change.
Thanks
Confirm this issue still exists, albeit it displays as Uncaught SyntaxError: Unexpected token 'export' (at Chart.js:46:1)
Removing the second script src=...
from index.html, as described by @gmlloves above, addresses it.
Not sure whether this issue can be reopened, @erossini? Looks like just the readme.md needs to be changed...
Hi,
I can confirm removing the second line works perfectly.
Thank you @skotl, and thank you @erossini for providing the wrapper!!
Thank you @skotl and @Ryan-ECPPro I'm working on a new version of the components with more functionalities. Hopefully soon, few improvements.
I have tried removing the 2nd line but for some reason the first time it loads it always seems to fail then when I refresh it works as expected.
Either way I am not sure if this bug should be classed as closed as its not fixed in the latest release and requires a manual workaround, are you able to issue a hotfix for this and do a larger release with all your other changes further down the line?
Hello,
I get this error on startup: Uncaught SyntaxError: export declarations may only appear at top level of a module Chart.js:46 Can you see it?
Thank you, Gaston.