You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can import other .ts files with the ES6 syntax like import { myFunction } from "./utils.js", i didn't try with a third party library yet.
It works but i'm a bit confused since i'm not really used to javascript development, so my questions are:
Is it ok to specify the "utils.js" extension or is it a sign i'm doing something wrong? the js import will fail without it.
Should i use npm to manage packages? can the ES6 syntax work with LibMan? I'm a bit confused by this.
Should I use webpack/rollup to bundle these files and in this case will Blazor component be able to invoke exported functions?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Blazor .Net 8, this works for both Server and Wasm modes.
What I'm doing at the moment is:
Microsoft.TypeScript.MSBuild
nuget packagetsconfig.json
file to the root of the project.ts
filestsconfig.json
will take all.ts
files from that folder and transpile them, not minified, into.js
files insidewwwroot/dist
await JsRuntime.InvokeAsync<IJSObjectReference>("import", "../dist/my-script.js");
This is the tsconfig (i'm not using node modules or npm):
I can import other
.ts
files with the ES6 syntax likeimport { myFunction } from "./utils.js"
, i didn't try with a third party library yet.It works but i'm a bit confused since i'm not really used to javascript development, so my questions are:
Thanks for the help : )
Beta Was this translation helpful? Give feedback.
All reactions