Question:
How do I set up Typescript with Symfony with the minimum amount of configurations changes to Symphony’s configuration files?
Here are the points that this solution should solve:
Typescript MVC Pattern in a private typescript directory:
src > XBundle > Resources > private > typescript
Javascript bundles compiled in :
src > XBundle > Resources > public > js
the private directory should consist of multiple apps for different pages. (If an app requires it's own
tsconfig.json
file, that's fine)an app is simply (for example) home.app.ts that imports (for example) a search.component.ts and a chat.component.ts
Compiled "apps" should be located in the public > js repository mentioned in point (2) and should be named (example taken from point (4)) home.bundle.js
In the
public > js
folder, there should only bex.bundle.js
filesAdding the bundles to my twig files, and calling my view should immediately run the bundle. I should not have to add an extra script to call the "
module
" (this is the reason why I want to avoidAMD
/System
)
What I'm not looking for:
I'm not looking for a solution with react
and angular
but a general solution using the /web
directory (or even the Resources directory in a bundle) at the root of a symfony project.
Most articles regarding this talk about symfony2
and try integrating react
and angular
.
I'm not looking for an installation tutorial for npm and tsc.
I don't need an automatic compile. I use Phpstorm so it does it automatically anyway.
<script>
tag like any other javascript file. Symfony is not aware of webpack existence. – Beep<script>
– Beep