Query:
How can I easily set up Typescript with Symfony without making extensive changes to Symphony's configuration files?
Here are the key requirements for the solution:
Typescript MVC Pattern should be set up in a private typescript directory:
src > XBundle > Resources > private > typescript
Javascript bundles should be compiled in :
src > XBundle > Resources > public > js
The private directory should contain multiple apps for various pages. Each app can have its own
tsconfig.json
file if needed.An app can consist of files like home.app.ts importing search.component.ts and chat.component.ts
Compiled "apps" should be stored in the public > js directory mentioned above and named, for example, home.bundle.js
Only
x.bundle.js
files should be present in thepublic > js
folderThe bundles should be added to twig files, and the view should run the bundle without the need for an extra script to call the "
module
". This is to avoid usingAMD
orSystem
What I Don't Want:
I am not interested in solutions involving react
or angular
, and prefer a general approach using the /web
directory or the Resources directory in a bundle within a Symfony project.
Most articles on this topic focus on symfony2
and attempt to integrate react
and angular
.
I do not need a step-by-step installation guide for npm and tsc.
An automatic compile feature is not necessary as Phpstorm already handles it automatically for me.