Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Source Maps with JS in Fragments
Is there any way to include/use source maps with the Javascript included in a fragment?
If one assumes that in certain cases i might have some reasonably complex JS in a fragment, and that i used some kind of transformation to generate the JS even as simple as using Typescript, is there any notion or idea how i could include/provide source maps for a fragment?
If one assumes that in certain cases i might have some reasonably complex JS in a fragment, and that i used some kind of transformation to generate the JS even as simple as using Typescript, is there any notion or idea how i could include/provide source maps for a fragment?
Hey Michael!At the moment it is not possible to add them to the portal, I'm afraidI am not sure about adding it to the portal, but in the fragments toolkit we have a preview functionality that allows to test the fragment before upload it to the server, would you found it useful to add the source maps there for ease the testing of the fragment?
Are fragment js files transpiled? I tried it with the sample fragment and my impression was that the code I write is just packaged without further processing. Or is it transpiled on the server?
In this case i am talking about writing a fragment offline (non-server) in Typescript. So yes it would be transpiled and produce a JS file. And let's say for example we are doing enough work using a framework or whatever that it produces a .map file that corresponds to the JS file. From what i can see there is no way to associate/use that map file on the server.
Maybe the problem is that this use case i am describing, where the fragment code is rich/complex enough that you'd want to use a framework & source maps, is not the target of fragments after all. And that the intent for fragments is just to provide smaller pieces of "glue"JS
Maybe the problem is that this use case i am describing, where the fragment code is rich/complex enough that you'd want to use a framework & source maps, is not the target of fragments after all. And that the intent for fragments is just to provide smaller pieces of "glue"JS
Yes, I understand. But I tried it with the sample liferay fragment code and "let x = 5;" stayed "let x = 5;". Maybe I did something wrong, I didn't really test it thoroughly.
AFAIK source maps are not supported currently, we are still experimenting, but we will probably only put minimal code into each fragment and put the actual sourcecode of our applications in extra modules, since we also need all those pesky dependencies to Vue or React.
AFAIK source maps are not supported currently, we are still experimenting, but we will probably only put minimal code into each fragment and put the actual sourcecode of our applications in extra modules, since we also need all those pesky dependencies to Vue or React.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™