dan
dan

Reputation: 2957

Can you reconcile an import statement using jspm alias vs importing the same package using the npm package name that webpack requires

Question: If you have a package that imports a jspm alias that is different from the npm package name is there a way to use the same package installed via npm where the import statement would need to be changed from the jspm alias name to the npm package name such as in the examples below?

Example installing breeze and how it is imported in the aurelia-breeze plugin

using jspm

You install breeze using an alias such as "breeze": "breeze-client" and then it is imported using import breeze from 'breeze';. This is how aurelia-breeze imports breeze

using webpack

webpack does not use aliases so you would install it via npm and import it using the package name such as import breeze from 'breeze-client'. This causes aurelia-breeze to fail since it is trying to import breeze instead of breeze-client

Would you have to have two plugins one that uses the jspm alias and one that uses the npm package name assuming the jspm alias is not the same as the npm package name?

With aurelia-breeze npm install it is easy to change so that it imports breeze-client, so this is not a big issue for me. I was just wondering if there is an easy way to handle these types of cases or am I just missing another way to use packages.

Upvotes: 0

Views: 90

Answers (1)

Renan Almeida Garcia
Renan Almeida Garcia

Reputation: 21

I particularly use JSPM only because I think it handles better with dependencies and is more automatic. At the time of importing only import the breeze and omit the breeze-client.

Upvotes: 0

Related Questions