Trying to use TypeScript and React with Tapestry: In TypeScript I need to use: import * as React from "react";
I would like to load react: react.min, so I have to set paths: {...} The configuration should be set at startup, but I cannot figure how to do it. I can set requirejs.config.shim, but not paths. I tried to load it with @Contribute(ModuleManager.class), but could not figure out how. PSEUDO CODE @Contribute(ModuleManager.class) public static void setupMyBaseModules(MappedConfiguration<String, Object> configuration) { JSONObject pathsConfig = new JSONObject( "react", "react.min", "react-dom", "react-dom.min" ); AMDResourceConfiguration paths = new AMDResourceConfiguration("paths", pathsConfig); configuration.add(null, new JavaScriptModuleConfiguration(paths)); } Tried to load it this way: @Startup public void registerToClearPlasticProxyFactoryOnInvalidation(JavaScriptSupport javaScriptSupport) { ModuleConfigurationCallback callback = new ModuleConfigurationCallback() { @Override public JSONObject configure(JSONObject configuration) { configuration.put("paths", new JSONObject( "react", "react.min", "react-dom", "react-dom.min" )); return configuration; } }; javaScriptSupport.addModuleConfigurationCallback(callback); } [ERROR] ioc.Registry org.apache.tapestry5.ioc.util.UnknownValueException: No object of type org.apache.tapestry5.services.javascript.JavaScriptSupport is available from the Environment. Now I am loading the configuration in @SetupRender, but it should be loaded globally. @Inject JavaScriptSupport javaScriptSupport; private static final ModuleConfigurationCallback CALLBACK = new ModuleConfigurationCallback() { @Override public JSONObject configure(JSONObject configuration) { configuration.put("paths", new JSONObject( "react", "react.min", "react-dom", "react-dom.min" )); return configuration; } }; @SetupRender public void configureRequireJS() { javaScriptSupport.addModuleConfigurationCallback(CALLBACK); } Can this be configuration be contribute to the ModuleManager.class? I think this should be supported in Tapestry. S-E