Servicestack javascript clients works fine. But after minifying and bundling whole application it is unable to request the url. It is requesting url like http://localhost/json/reply/e instead of POCO name.
I am mostly missing something. But couldn’t figure it out. It would be great if someone can point me into right direction.
We’re going to need a lot more info on exactly what the issue is and what you’re referring to. What did you minify, how? and what code is no longer working?
Thanks for quick reply. I’m using service stack client library with Fable-Elmish .
It is working great in dev mode. Without any issues. Means I don’t have to provide URL. Library is figuring out.
But when I minified using web pack. It just request alphabet. As shown in above question. My best guess it, it is minifying javascript object names (F# types ) and that is breaking the client. I’m sure that if I give URL too it will work (haven’t tried though).
But currently whole no URL option broke for me in minified code.
Fable-ElMish: it is wrapper around react and redux to provide elm architecture in F#. Fable transpile to ES6 and then bable transpile to current java script. And all magic happens using web pack.
This description isn’t helpful, please provide the exact source code that’s causing the issue, including the libraries you’re using as well as the DTOs. i.e. provide all relevant info in order to be able to reproduce the issue.
You should be able to use minified TypeScript Service Client generated DTOs, but if you’re using regular JavaScript classes you wont be able to minify them because the client needs the type name in order to construct the URL to query the Service and if you minify plain JS DTOs the Request DTO name is lost.
Here is the project to reproduce the issue. You can follow read me to run it in dev mode.
Then for Todo in dev mode URL coming as http://sometodourl/json/reply/ToDoByUser . Now if you run command dotnet fable npm-run build it will create minified javascript for whole project. Currently it is checked in into public folder.
So, you can run any local server for public folder (I am using node http-server). It will run everything but while hitting server it is coming as http://sometodourl/json/reply/e .
PS: sometodourl I put as dummy url. As I am just testing for generated url while hitting network.
And
PS: This was the demo I was talking about a little back. Years back in early days of Servicestack you introduce the concept of message passing for communication with server for dot net. Now, every latest java-script architecture like Elm, Fable-Elmish is using it. They force server framework to think in message passing and as servicestack is already having concept it; it fits right into it. Even here I just copy -pasted DTOs and they are used directly as model. I don’t have to translate it anyway. And thanks for seeing the future way back in past.
I’ve just ran into this issue after getting our minified production build for React. Our project is JS / JSX, and we use the TypeScript DTO’s transpiled to js and minified, but receive all the same errors. @mythz was there something else we have to do to make this work?