Dojo cross domain load issue - dojo

I'm getting a cross domain error when trying to load a custom class. Here is my directory structure
lib
/dijit
/CustomClass1
gic
/dijit
/CustomClass2
CustomClass2 inherits from CustomClass1, but this is where I'm getting the cross domain error.
I'm including the require in CustomClass2:
require("lib.dijit.CustomClass1");
I believe I need to add a module path. I tried the statement below (with many variations) but I haven't gotten it to work. Any ideas?
dojo.registerModulePath("gic", "gic");

Cross domain refers to retrieving the javascript files from a server that is not the domain that is serving the web application itself. An example is loading dojo from a CDN.
http://dojotoolkit.org/reference-guide/1.7/quickstart/cross-domain.html
From what you posted, I can't tell if you are using dojo from a CDN or not. If you are, then this link should help you configure your module path:
http://dojotoolkit.org/documentation/tutorials/1.6/cdn/
If not, then it is important to note that the second parameter is a directory path and is relative to dojo.js
dojo
dojo.js
lib
dijit
gic
dijit
dojo.registerModulePath("lib", "../lib");
dojo.registerModulePath("gic", "../gic");
If you are having this problem doing a custom build, then you need to set prefixes in the profile:
prefixes: [
[ "dijit", "../dijit" ],
[ "lib", "../lib" ],
[ "gic", "../gic" ]
]

Related

Unreal Engine 5 Plugin: Missing import: UnrealEditor-SteamVR.dll

I have a plugin that fails to load initially when starting up my project and gives this error: The game module ‘PluginName’ could not be loaded. There may be an operating system error or the module may not be properly set up
When reviewing the log file I see that the issue is caused by:
Missing import: UnrealEditor-SteamVR.dll
If I copy this DLL from the Unreal Engine 5 plugins into my Plugin's Binary folder, the project will open as normal and load the plugin. However, this was not the case for Unreal Engine 4, so I'm trying to see why I need to copy this DLL now.
In my plugin Build CS file I have a reference to SteamVR. Maybe this needs to be updated?
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
// ... add other public dependencies that you statically link with here ...
"CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "OpenVR"
}
);
PrivateDependencyModuleNames.AddRange(new string[] { "SteamVR" });
How to get this to work without manually adding in the DLL?
I edited my .uplugin file and added the SteamVR plugin dependency, which resolved the issue.
"Plugins": [
{
"Name": "SteamVR",
"Enabled": true
}
]
Edit 1:
I discovered that though multiple Steam libs were included in my C++ it was a function from the SteamVRFunctionLibrary responsible for causing the issue on startup when the SteamVR plugin isn't enabled.

Nuxt generate failing with self is not defined in a vue dist file

I'm preparing to deploy my first Static app from a Nuxt.js 2 project.
While the static routes are generated fine, my dynamic routes are not. Once I remembered they were hidden in my dropdown menu - duhh - I created a /generate page which renders all my dynamic routes using the nuxt-link component. My assumption was that the crawler should find the /generate/index.vue page and thus the links on it, and crawl those.
It didn't.
Then I noticed a comment from Sebastien Chopin mentioning that SSR should be enabled when generating Static apps. Ok. So I re-enabled SSR and I've hit nothing but errors. A couple I've figured out but this latest one has got me stumped.
Some googling has not revealed a clue that appeared relevant - or at least I didn't recognise them as relevant - so I need the 'worldwide developers' team help.
Does this error suggest there's an issue in Vue itself? I don't use 'self' anywhere in my app code soooo... hmmm?
Cheers,
Jeremy
Well it's generating now (has been for a few weeks, been a busy time!)... however the generated pages are not outputting with content, but I think that's a different issue.
My configuration currently is;
target: 'static',
ssr: false,
generate: {
minify: false, // Nuxt 2.15.4 > Deprecated next major version > Use build.html.minify instead!
routes: dynamicRoutes
}
I'll keep working on it.

Creating multi-page application with Vue CLI3.0, how to handle this error?

I am a beginner of Vue and I am trying to build a multi-page web application with Vue for practice. But I am having this problem below:
Failed to compile.
./src/index/views/Home.vue?vue&type=script&lang=js& (./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/index/views/Home.vue?vue&type=script&lang=js&)
Module not found: Error: Can't resolve '#/components/HelloWorld.vue' in '/home/Username/Web/wk_front_end/src/index/views'
Here is the file tree of my project, every file is generated by Vue because I only want to test the multi-page, so I think it wouldn't be a coding problem.
Here is what I did:
I created a folder called the index under the src folder, I then move all the files and folders that originally under src to index because I wish the components and assets are only used in the corresponding page.
My vue.config.js is:
module.exports = {
pages: {
index: {
entry: "src/index/main.js",
template: "src/index/index.html",
filename: "index.html",
title: "Index Page"
},
}
}
When I try to run it, I got the error above on the chrome window. And actually, the error is:
I think it might be caused by missing of configurations, but I really cannot figure out what those other configurations I need.
Does anyone have similar problem before? Does anyone know how to solve it? Or, does anyone have some successful multi-page example that I could take a look?
Really thanks for the help.
I believe # is a shortcut for the src folder. Which would mean your current path resolves to src/components/HelloWorld.vue.
You could try doing #/index/components/HelloWorld.vue, which should be the correct path.
From my sight you may be importing your Vue components incorrectly. If you want to make multi-page-app why don't you try vue-router ? Maybe it's not the direct solution for your problem but it will help you to better manage your pages (routes) in the future.

Load debug version of pre-built module via npm/webpack

There is a javascript library, pre-built and available on npm, that I wish to develop with/debug. In my case, it is openlayers.
In the classic way of requiring a javascript file and wanting to debug, one would just switch the script url from the production version to the debug version, ie:
to
However, when using webpack and then importing via npm:
import openlayers from 'openlayers'
Gets you the production distribution of the library, the same as the ol.js script from above.
On a side note, to stop webpack trying to parse a prebuilt library and throw a warning about that you must include something like this:
// Squash OL whinging
webpackConfig.module.noParse = [
/\/dist\/ol.*\.js/, // openlayers is pre-built
]
Back to the problem at hand: how can I conditionally load a different entry-point for a module prebuilt and imported like this?
Of course, I can do it in a hacky way. By going into the node_modules/openlayers/package.json and switching the browser field from
"browser": "dist/ol.js",
to
"browser": "dist/ol-debug.js",
Is there a way I can request a different entry point via webpack or by using a different import syntax? Do I first have to petition the library maintainers to update the browser field to allow different entry point hints to browsers, according to the spec? https://github.com/defunctzombie/package-browser-field-spec
Thoughts on a more effective way to make this happen? Yearning to be able to programmatically switch loading of the production and debug versions of a library based on env variables.
Webpack has configuration options for replacing a module into a different path: https://webpack.github.io/docs/configuration.html#resolve-alias
This resolves the openlayers import to use the debug version:
webpackConfig.resolve.alias: {
openlayers: 'openlayers/dist/ol-debug.js'
}
In my build system I have a function that takes the environment type and returns the matching webpackConfig. Based on the parameter I include the above snippet or not.
Full code: webpack-multi-config.js
I have two different (gulp-) tasks for development and production. For example the production task: webpackProduction.js
Line 1 imports the config script with production as type.
My build system is based on gulp starter.

does dojo config support requirejs bundles

Does dojo config support requirejs bundles?
Introduced in RequireJS 2.1.10: allows configuring multiple module IDs to be found in another script. Example:
requirejs.config({
bundles: {
'primary': ['main', 'util', 'text', 'text!template.html'],
'secondary': ['text!secondary.html']
}
});
require(['util', 'text'], function(util, text) {
//The script for module ID 'primary' was loaded,
//and that script included the define()'d
//modules for 'util' and 'text'
});
That config states: modules 'main', 'util', 'text' and 'text!template.html' will be found by loading module ID 'primary'. Module 'text!secondary.html' can be found by loading module ID 'secondary'.
In Dojo 1.8 modules were converted to AMD format, however dojo uses some "special loader plugins" which are still in draft and could be not fully compatible with RequireJS. On RequireJS documentation it is suggested to use Dojo's AMD loader instead.
Related doc from Dojod bug tracker ticket 15616.
Please note in case you need to "build" your dojo application you should use dojo util and app.profile.js,where you can specific a list of modules to "bundle" there.
I would suggest to have a look at this dojo-boilerplate as starting point for your dojo build configuration: https://github.com/csnover/dojo-boilerplate
A useful resource on the dojo build can be also found here: https://dojotoolkit.org/reference-guide/1.10/build/