0

I'm trying to use module: module.id in my Angular 2 Components to use relative paths in the components. I referenced this article here and want to use the CommonJS option.

I have also checked other Stack Overflow questions, like this one, and followed its instructions by installing the node typings.

After doing all that, I believe it's working, seeing as how the app loads in the browser and works as expected, but my gulp project shows an error of:

error: TS2304: Cannot find name 'module'.

I'm not sure why the error pops up in gulp but the app still loads. Does anyone have any ideas as to why this would happen? Is there something I can do to let gulp know so the error doesn't show up in the build process?

Community
  • 1
  • 1
pjlamb12
  • 2,300
  • 2
  • 32
  • 64

1 Answers1

0

After some more digging and getting kind of lucky, I realized that the index.d.ts file with the reference to the node typings wasn't included in the typescript transpiling task in my build process. Once adding that in there, the errors disappeared.

pjlamb12
  • 2,300
  • 2
  • 32
  • 64
  • just a heads up, i use gulp jspm builder for bundling my Angular2 RC 1 app and it does not work with relative paths, even with commonjs moduleid set. Not sure how you are bundling you app, but just wanted to save you some time if you are using gulp to bundle you app and not webpack or something else. – J King Jun 10 '16 at 17:47