Open andriykrasnychuk opened 2 days ago
Hi @andriykrasnychuk, Thank you for opening this ticket.
Let's discuss about it 😃
I don't think published packages should include their source files as well. Usually, all packages only ship the build output and that's it. Maybe here the mistake was to have the js map in the first place, which refers to source files that are not part of the published packages and I don't think the solution would be to push the sources as part of those published packages.
In general, let me know what you think, when you are debugging something and you are working with typescript, you will be able to put breakpoints in your project ts files but then when you reach a third party package you usually step into and end up in the js file, which is quite normal I would say.
Also, you can quickly have discrepancies if you do any changes in the js files, during you debugging session, to alter the runtime behaviour (or test a quick fix). And the ts files and map files wont be able to take that into consideration, forcing you to debug inside the js file.
So to summarize, my take wouldn't be to add the src to files, but rather remove the js map as part of the build output.
cc @oliverheaps @thetutlage @sradevski
Hi, @adrien2p , thanks for such quick response. I understand your point. Most libraries have just js
files.
In case of medusa the question if it is just "simple package". (I'm making my point from my use case using it:) ) Right now I'm considering if medusa is a proper solution for our needs - a lot of modules gonna be extended/modified. Also I'm new with medusa - for better understanding how it's done it's to go throw... reading the "compiled" js files is not that convenient :) so now I often read the sources from github to better understand what actually happened....
What the downsides of adding the sources except the package size?
to summarize, I'd like to have src (in case with medusa) instead pure js :)
thanks!
Hello @andriykrasnychuk 👋
Sure, we do want Medusa to provide a great developer experience in almost every area of development.
I am trying to understand how publishing the source files will help in your specific situation? Maybe you can expand a bit more on your workflow?
From my limited experience, publishing source files haven't helped me much with the following workflow.
In this scanerio, when the stack trace points me to the TypeScript source. I will have to also find the related JavaScript file and make changes inside it.
Ofcourse, I am talking about a particular workflow here. So curios to know what your workflow looks like and how the source files can help you.
Hello, @thetutlage I do not have some "common workflow" how we develop using medusa - still in investigating stage if medusa suites for us. I come up with creating this issue here because of some probably medusa another bug - for new order wrong customer id is written ot DB. Had another problems as well...
anyway... typescript is "handy" and I from my perspective I can't find arguments if you have everything already pushed to public github not to share that sources to let community enhance product easier. :) but it is your product - up to you remove the .maps or add src :)
thank you
P.S. about that stacktrace you'e mentioned . If I would find an issue and have a solution in medusa I'd most likely create a PR in your repo to push that fix in new version :)
Package.json file
Node.js version
v20
Database and its version
N/A
Operating system name and version
N/A
Browser name
N/A
What happended?
Debugging native packages of medusa not possible.
Expected behavior
typescript files with its source maps loaded
Actual behavior
Debugging not working - no src files for generated source maps for example:
Could not load source '/workspaces/deity-medusa/node_modules/@medusajs/workflows-sdk/src/utils/composer/create-workflow.ts': Unable to retrieve source content.
Link to reproduction repo
https://github.com/medusajs/medusa/blob/develop/packages/medusa/package.json#L28