Description
Symfony version(s) affected
all
Description
I was trying to serve the assets of a compiled Angular application thanks to the AssetMapper in order to have small units of Angular on my pages without having a full Angular application.
Things were working pretty well until I got one of my imported chunks not compiled into the importmap, resulting in a 404 when the chunk was imported.
After a few investigations, I found out that it was because Angular have some functions with a name like ɵɵdefineComponent
, with Greek letters, and that these letters are preventing the regex from doing a proper job.
How to reproduce
- Follow the installation of AssetMapper as explained in Symfony documentation
- Create a new file
assets/dependency.js
with a method nameɵmyMethod
- At the top of
app.js
addimport { ɵmyMethod } from './dependency.js'
=> Look at the importmap generated in the DOM, the file dependency.js
was not added to it
Possible Solution
Just adding the unicode character matcher \p{L}
along with the already existing \w\s{},*
seems to work pretty well as shown in these two regex :
Existing regex (link available in the JavaScriptImportPathCompiler code) where I added a ɵ
in the imported function name : https://regex101.com/r/oqY4Ck/1
Fixed regex with \p{L}
: https://regex101.com/r/dxEXjq/2
Additional Context
No response