Upgrade to ionic2 RC0: Not found @types/require


#1

This is what changelog from ionic2-beta11 to ionic2-rc0 suggests: “delete your typings folder”.

Now i that typings folder there where my require typings. Then I do

`npm install @types/require --save-dev --save-exact``

but I get:

Not found @types/require .

When reading through this thread by typings developers

then I come to the conclusion that they do not favor the npm solution and abandoned the idea. Now why is Ionic promoting an idea that is non supported by typings team? As it stands I think I will follow best-practice and use native typings. What do you guys think about it?


#2

That you should delete your typings folder, move to using TypeScript 2’s support for npm @types things, and probably most importantly eliminate your dependence on require, because it isn’t going to work like you expect. You’re going to need to switch to using import. See more here.


#3

You did not read my question. I want an informed discussion about this, why npm is superiour over the other registries, I know how to use npm.

Require is something we need, and it worked perfectly fine in Beta11 - please give a reason why it should not work anymore. Any if not, how can I use a different technique.


#4

Yes I did. I quoted it. You asked for people’s opinions. I gave you mine.

Because it’s already in use, so using it avoids multiplying entities.

Because the bundler is different, and rollup does not implement require in wart-for-wart compatible fashion with node.

That was what the link in my previous comment was intended to do. Good day.


#5

You did not read my question.

Yes I did. I quoted it. You asked for people’s opinions. I gave you mine.

I asked pros & cons of both methods, you basically argued “use method one because I said so”. This is why I was pissed. No biggy. :slight_smile:

What does this sentence mean, it is beyond my current comprehensive capabilities.

This is our code:

private mapTargetNameToComponent(navTarget: NavTargetEnum): any {
  switch (navTarget) {
    case NavTargetEnum.MY:
        return require("../../../+mine/my/my.component")["myComponent"];
        ..

We use Enums to build a dynamical Navigational Logic, we can’t use navController.setRoot in our Navigational Serivce (code above) without require. If you have an idea how to work around this, I would be happy to hear it.