Re: Contribute requirejs.config.paths to ModuleManager
Hi, It has been a while since I last fought the module system, but in some cases I've used a request filter to map between module and asset paths (triggering on known module paths and then returning permanent redirects to the actual asset urls in the filter) - This was necessary in order to get stuff like CK editor to load properly as a module and still allowing it to dynamically require its plugins IIRC. -- Chris On Mon, Nov 27, 2017 at 2:14 PM, Svein-Erik Løken wrote: > Got this error message (very informative): > > org.apache.tapestry5.ioc.util.UnknownValueException > Unable to create a client URL for classpath resource > META-INF/modules/react/react.min.js: The resource path was not within an > aliased path. > availableValues > Aliased paths: > • META-INF/assets > • META-INF/assets/core > • META-INF/assets/democore > • com/demo/core > • com/demo/module1 > • com/demo/module1 > • org/apache/tapestry5 > • org/apache/tapestry5 > > > > Tried other locations: > > public class ReactStack implements JavaScriptStack { > private final AssetSource assetSource; > > public ReactStack(final AssetSource assetSource) { > this.assetSource = assetSource; > } > > public List getJavaScriptLibraries() { > List ret = new ArrayList<>(); > //ret.add(assetSource.getClasspathAsset("/META-INF/ > modules/react/react.min.js")); > //ret.add(assetSource.getClasspathAsset("/META-INF/ > assets/react/react.min.js")); > //ret.add(assetSource.getClasspathAsset("/META-INF/ > assets/react/react.js")); > //ret.add(assetSource.getClasspathAsset("/META-INF/ > assets/react.min.js")); > ret.add(assetSource.getClasspathAsset("/META-INF/ > assets/react.js")); > return ret; > } > > > Still getting: > Loading 1 libraries > Loading library /assets/meta/z94ea83c9/react.js > Executing 3 inits > Loaded module bootstrap/collapse > GET http://localhost:9876/modules.gz/react.js 404 (No module for path > 'react.js'.) > > Very strange that the virtual link does not work! > > S-E > > > From: Thiago H de Paula Figueiredo [via Apache Tapestry Mailing List > Archives] [mailto:ml+s1045711n5733729...@n5.nabble.com] > Sent: mandag 27. november 2017 13:32 > To: Svein-Erik Løken > Subject: Re: Contribute requirejs.config.paths to ModuleManager > > On Sun, Nov 26, 2017 at 10:40 AM, Svein-Erik Løken > wrote: > > > Source code: > > > > > @Contribute(JavaScriptStackSource.class) > > public static void addMyStack(MappedConfiguration > JavaScriptStack> configuration) { > > configuration.addInstance("react", ReactStack.class); > > } > > > > @Contribute(JavaScriptStack.class) > > @Core > > public static void addAppModules(OrderedConfiguration > > configuration) { > > configuration.add("react", StackExtension.module("react")); > > } > > > > These look correct. ^^^ > > > public class ReactStack implements JavaScriptStack { > > private final AssetSource assetSource; > > > > public ReactStack(final AssetSource assetSource) { > > this.assetSource = assetSource; > > } > > > > public List getJavaScriptLibraries() { > > List ret = new ArrayList<>(); > > ret.add(assetSource.getClasspathAsset("/META-INF/ > > assets/react.min.js")); > > return ret; > > } > > > > @Override > > public List getModules() { > > List ret = new ArrayList<>(); > > ret.add("react"); > > return ret; > > } > > > > I believe your error was having the getModules() method above return a list > with 'react'. According to its JavaDoc, getModules() must return the > modules on which this stack depends. It doesn't actually depend on the > 'react' module. Please try having that method return an empty List and tell > us what happens. > > You may also need to move react.min.js to > /META-INF/modules/react/react.min.js. > > > If you reply to this email, your message will be added to the discussion > below: > http://apache-tapestry-mailing-list-archives.1045711. > n5.nabble.com/Contribute-requirejs-config-paths-to-ModuleManager- > tp5733721p5733729.html > To unsubscribe from mailto:users@tapestry.apache.org Mailing List > Archives, http://apache-tapestry-mailing-list-archives.1045711. > n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node= > 2375125&code=c3ZlaW5AamFjaWxsYS5ub3wyMzc1MTI1fC0xNTM4NzY2ODg4. > http://apache-tapestry-mailing-list-archives.1045711. > n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html% > 21nabble%3Aemail.naml&base=nabble.naml.namespaces. > BasicNamespace-nabble.view.web.template.NabbleNamespace- > nabble.view.web.template.NodeNamespace&breadcrumbs= > notify_subscribers%21nabble%3Aemail.naml-instant_emails% > 21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml >
RE: Contribute requirejs.config.paths to ModuleManager
Got this error message (very informative): org.apache.tapestry5.ioc.util.UnknownValueException Unable to create a client URL for classpath resource META-INF/modules/react/react.min.js: The resource path was not within an aliased path. availableValues Aliased paths: • META-INF/assets • META-INF/assets/core • META-INF/assets/democore • com/demo/core • com/demo/module1 • com/demo/module1 • org/apache/tapestry5 • org/apache/tapestry5 Tried other locations: public class ReactStack implements JavaScriptStack { private final AssetSource assetSource; public ReactStack(final AssetSource assetSource) { this.assetSource = assetSource; } public List getJavaScriptLibraries() { List ret = new ArrayList<>(); // ret.add(assetSource.getClasspathAsset("/META-INF/modules/react/react.min.js")); // ret.add(assetSource.getClasspathAsset("/META-INF/assets/react/react.min.js")); // ret.add(assetSource.getClasspathAsset("/META-INF/assets/react/react.js")); // ret.add(assetSource.getClasspathAsset("/META-INF/assets/react.min.js")); ret.add(assetSource.getClasspathAsset("/META-INF/assets/react.js")); return ret; } Still getting: Loading 1 libraries Loading library /assets/meta/z94ea83c9/react.js Executing 3 inits Loaded module bootstrap/collapse GET http://localhost:9876/modules.gz/react.js 404 (No module for path 'react.js'.) Very strange that the virtual link does not work! S-E From: Thiago H de Paula Figueiredo [via Apache Tapestry Mailing List Archives] [mailto:ml+s1045711n5733729...@n5.nabble.com] Sent: mandag 27. november 2017 13:32 To: Svein-Erik Løken Subject: Re: Contribute requirejs.config.paths to ModuleManager On Sun, Nov 26, 2017 at 10:40 AM, Svein-Erik Løken wrote: > Source code: > > @Contribute(JavaScriptStackSource.class) > public static void addMyStack(MappedConfiguration JavaScriptStack> configuration) { > configuration.addInstance("react", ReactStack.class); > } > > @Contribute(JavaScriptStack.class) > @Core > public static void addAppModules(OrderedConfiguration > configuration) { > configuration.add("react", StackExtension.module("react")); > } > These look correct. ^^^ > public class ReactStack implements JavaScriptStack { > private final AssetSource assetSource; > > public ReactStack(final AssetSource assetSource) { > this.assetSource = assetSource; > } > > public List getJavaScriptLibraries() { > List ret = new ArrayList<>(); > ret.add(assetSource.getClasspathAsset("/META-INF/ > assets/react.min.js")); > return ret; > } > > @Override > public List getModules() { > List ret = new ArrayList<>(); > ret.add("react"); > return ret; > } > I believe your error was having the getModules() method above return a list with 'react'. According to its JavaDoc, getModules() must return the modules on which this stack depends. It doesn't actually depend on the 'react' module. Please try having that method return an empty List and tell us what happens. You may also need to move react.min.js to /META-INF/modules/react/react.min.js. If you reply to this email, your message will be added to the discussion below: http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/Contribute-requirejs-config-paths-to-ModuleManager-tp5733721p5733729.html To unsubscribe from mailto:users@tapestry.apache.org Mailing List Archives, http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2375125&code=c3ZlaW5AamFjaWxsYS5ub3wyMzc1MTI1fC0xNTM4NzY2ODg4. http://apache-tapestry-mailing-list-archives.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
Re: Contribute requirejs.config.paths to ModuleManager
On Sun, Nov 26, 2017 at 10:40 AM, Svein-Erik Løken wrote: > Source code: > > @Contribute(JavaScriptStackSource.class) > public static void addMyStack(MappedConfiguration JavaScriptStack> configuration) { > configuration.addInstance("react", ReactStack.class); > } > > @Contribute(JavaScriptStack.class) > @Core > public static void addAppModules(OrderedConfiguration > configuration) { > configuration.add("react", StackExtension.module("react")); > } > These look correct. ^^^ > public class ReactStack implements JavaScriptStack { > private final AssetSource assetSource; > > public ReactStack(final AssetSource assetSource) { > this.assetSource = assetSource; > } > > public List getJavaScriptLibraries() { > List ret = new ArrayList<>(); > ret.add(assetSource.getClasspathAsset("/META-INF/ > assets/react.min.js")); > return ret; > } > > @Override > public List getModules() { > List ret = new ArrayList<>(); > ret.add("react"); > return ret; > } > I believe your error was having the getModules() method above return a list with 'react'. According to its JavaDoc, getModules() must return the modules on which this stack depends. It doesn't actually depend on the 'react' module. Please try having that method return an empty List and tell us what happens. You may also need to move react.min.js to /META-INF/modules/react/react.min.js.