Project

General

Profile

Bug #101373

Updated by Stefan P almost 1 year ago

I have an extension that adds a new form element defintion to @EXT:form@, running on TYPO3 12. I wanted to use the latest v12 JavaScript register method, as mentioned in the docs: 
 * https://docs.typo3.org/c/typo3/cms-form/12.4/en-us/I/Concepts/FormEditor/Index.html#register-custom-javascript-modules 
 * https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Feature-96510-InfrastructureForJavaScriptModulesAndImportmaps.html 
 * https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Deprecation-96568-RequireJSModulesInFormFramework.html 

 In the form editor YAML, if I replace the deprecated @dynamicRequireJsModules@ with @dynamicJavaScriptModules@, add the @JavaScriptModules.php@ file and adjust the format of the js file accordingly, I get this error in the Browser console: 
 @Unable to resolve specifier '@myvendor/my-extension/Backend/FormEditor/ViewModel.js'@ 

 So, the YAML is correctly parsed and the correct file should be loaded. Dumping the import map inside the @JavaScriptModules.php@ loader, I can also see that this is registering my JS file with the same structure as every other JS file from core extensions. 

 But it still can not be resolved and loaded in the Browser. I tried upper and lowercase names (bot in actual file names as well in the config files), different ways of writing the EXT key (like "my_extension" and "my-extension"). I looked how core extensions register JS modules and adapted my code. Nothing works. 

 Using the deprecated v11 way works without any problems. 

 Is this a bug in the form extension or is something missing in the documentation?

Back