It's the Xinrui Ma

Blog

Tag: AWS

How to solve “Cannot find name ‘require’ ” problem on Angular 2 project

It’s magic:

I want to include AWS library on my angular2 project, I was looking at https://github.com/aws/aws-sdk-js

Steps I follow:
1. npm install --save-dev @types/node
2. find tsconfig.app.json, edit those two MAGIC lines:
"types": [ "node" ],
"typeRoots": [ "../node_modules/@types" ]

3. npm install aws-sdk

4. I can safely add var AWS = require('aws-sdk'); in my project now.

Remeber the magic!