How to use webpack import aws-sdk

Question:

I found this issues in the official, but it looks like they refused to answer.
So I can only ask questions on SO.
Here is my Error&Warning Log:

There are three types:

  1. Cannot resolve module ‘fs’

I only need to install fs can solve this.

  1. need an appropriate loader

Well, this will need to install json-loader, and set it in webpack.config.js, but also can solve.

  1. Critical dependencies
  2. Module not found: Error: Cannot resolve directory ‘.’

I webpack newbie.So, i don’t know how to solve this.
Will someone help me? thanks.

UPDATE:

  1. Module not found: Error: Cannot resolve directory ‘.’

that is my fault, config file’s extensions missing a .

Answer:

Using the noParse method should work if you are creating a node package, as this is setting webpack to not apply any parsing/loaders. This did not work for me when creating a umd formatted output file/library.

To create a umd formatted library I had to use loaders to Browserify aws-sdk and handle json files.

Install the loaders:

npm install json-loader --save-dev

npm install transform-loader brfs --save-dev

Webpack Config:


Replace LibraryName with you own namespacing. Currently the library would be used through a constructor as follows:

Leave a Reply