-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use dependency as global in specific package? #666
Comments
Yes that should work, but only if the module is CommonJS or global format. Globals and meta are normalized certainly. |
Because the |
Yes these options are restricted. Although there is consideration to extend deps (not globals) to ES modules in #640. |
I'm afraid I can't get this to work. To clarify, this is relevant when trying to use code from Three.js's examples, like the STLLoder If there is a way to verify (debug) the package configuration per package that would help a great deal. |
By simply exposing the global globally I can get this to work, see: Relevant config:
But I would prefer to contain this "global" within the dependency that requires that global. |
The above approach didn't work when importing Three.js examples. When setting Three.js to Setting the System.config({
"map": {
"three.js": "github:mrdoob/three.js@master",
"three.js/loaders/STLLoader": "github:mrdoob/three.js@master/examples/js/loaders/STLLoader.js",
}
"meta": {
"three.js/loaders/STLLoader": {
"deps": [
"three.js"
],
}
}
}); Summary:
|
|
|
What is the difference between the effects of following two configs? System.config({
packages: {
'./global-user.js': {
meta: {
deps: [
'./global-creator.js'
]
}
}
}
}); System.config({
meta: {
'./global-user.js': {
deps: [
'./global-creator.js'
]
}
}
}); |
I'm trying to give a global formatted module it's global dependency using a packages > meta > globals config. Used config: System.config({
packages: {
'./global-user.js': {
meta: {
globals: {
'SOME_GLOBAL': './global-creator.js'
}
}
}
}
}); It seems to be available:
But Trying to set this without the System.config({
meta: {
'app.js': {
globals: {
'SOME_GLOBAL': './global-creator.js'
}
}
}
}); |
In the last config above I forgot the Without the
So the question stays, how can I make the dependency's dependency ( |
Packages must be folders not files, with meta within them. |
Also package meta must reference a file path within the package. |
Alright, I put the global-user in a folder, which I reference with packages. I'm referencing the specific file in a meta. Which creates: packages: {
'./global-user': {
meta: {
'./global-user/index.js': {
deps: [
'./global-creator.js'
],
globals: {
'SOME_GLOBAL': './global-creator.js'
}
}
}
}
} I've also combined all the config in one System.config call. |
You need to replace the meta path in the above with |
Ah...
packages: {
'./global-user': {
meta: {
'index.js': {
globals: {
// 'SOME_GLOBAL': './global-creator.js'
'SOME_GLOBAL': 'global-creator.js'
}
}
}
}
} |
I've created a separate issue on meta paths: #692 |
Yes The |
I basically have the following question, but I'm getting the feeling the current answer is wrong.
http://stackoverflow.com/questions/28068038/how-do-i-import-additional-plugins-for-an-already-imported-library-using-jspm
I'm trying to import an example file, which depends on another package being available as global variable.
If I understand the configuration documentation and this add support for cjs globals commit correctly I could do the following?
I understand that meta globals support where added in SystemJS release
0.18.6
, which, looking in thesystem.js
file injspm_packages
I'm using.Sub questions are whether deps and globals are normalized (like packages and meta paths in configuration).
The text was updated successfully, but these errors were encountered: