jspm / registry

The jspm registry and package.json override service
https://jspm.io
229 stars 255 forks source link

Cannot import from @angular/core/testing #976

Closed frederikschubert closed 8 years ago

frederikschubert commented 8 years ago

Angular updated their publishing directory structure since RC 6 and it is not possible anymore to import from @angular/core/testing as JSPM tries to fetch jspm_packages/npm/@angular/core@2.0.0/testing.js where it should be fetching jspm_packages/npm/@angular/core@2.0.0/bundles/core-testing.umd.js. The main entry already points to bundles/core.umd.js and the mapping for testing should be analogous.

I tried to import from @angular/core/testing/index but that doesn't work either because then the imports from the successfully fetched core module to other modules like @angular/compiler/testing will fail.

Related to https://github.com/jspm/jspm-cli/issues/2080

guybedford commented 8 years ago

Do you want to just import @angular/core/bundles/core-testing.umd.js then?

frederikschubert commented 8 years ago

Yes. I would like to map @angular/{core,platform-browser,compiler,etc.}/testing to @angular/core/bundles/{core,platform-browser,compiler,etc.}-testing.umd.js.

guybedford commented 8 years ago

Are you on jspm 0.17 or 0.16?

frederikschubert commented 8 years ago

0.17.0-beta.28

guybedford commented 8 years ago

Then you can edit jspm_packages/npm/@angular/core@x.y.z.json and add the line:

"map": {
  "./testing": "./bundles/core-testing.umd.js"
}

and the same for the others.

frederikschubert commented 8 years ago

Ah that works! I tried adding a mapping but didn't find any documentation on the syntax. I guess that those mappings should be added to the registry? I would like to make a PR! Thank you for your help! Greatly appreciate what you are doing for this project.

guybedford commented 8 years ago

A PR with the necessary configs for Angular is welcome.

vigie commented 7 years ago

I am on JSPM 0.16 and now when I install @angular/core a testing.js file is written with the following:

module.exports = require('@angular/core@2.4.7/bundles/core-testing.umd/index');

This causes module loading failures at runtime.

How can I prevent /index from being appended in this file? If I remove it manually it works fine.

Thanks

GinaLazar commented 6 years ago

Hello, I'm having the exact same issue but I use jspm 0.16. Is there any way to map to the correct file from the bundles folder instead of testing.js?

aluanhaddad commented 6 years ago

@GinaLazar you could install it with an override but this should not be necessary. For example, you could run

jspm install @angular/core=npm:@angular/core --override override.json

where override.json contains

{
  "map": {
    "testing.js": "bundles/core-testing.umd.js"
  }
}