[StimulusBundle] Exception thrown when .ts
controller transpiled to .js
in the same directory
#2701
Labels
.ts
controller transpiled to .js
in the same directory
#2701
The
loadCustomControllers
function iterates over all.ts
and.js
files in the project's controllers path to build a controller map.My project has a build step where TypeScript controllers are transpiled to JavaScript files that are saved alongside the source TypeScript files. My asset mapper config excludes TypeScript files since I'm only interested in serving JavaScript.
When
loadCustomControllers
iterates over all.ts
and.js
files in my controllers path, it tries to load mapped assets for my.ts
controllers. But since these files are excluded, the returned asset isnull
and an exception is thrown when it tries to read thesourcePath
property on thenull
asset.Controller files should be a mapped asset. Not finding one indicates a problem so an exception should be thrown (e.g. see
null
mapped asset check inloadUxControllers
function). However theloadCustomControllers
function doesn't realize there are.js
and.ts
versions of the same controller and can skip processing the missing version.I expected that I could exclude
.ts
controller files when.js
versions are available.Here's my proposed fix:
.ts
controller file if a.js
version is availableloadUxControllers
Related: #1210
The text was updated successfully, but these errors were encountered: