-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Webpack support #603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think in this case a site like StackOverflow might be a better venue to ask this kind of question. The SDK unfortunately does not currently support Webpack, since we currently have our tooling working with browserify. It seems like this specific issue might be a lot more complicated to solve based on the error, but someone who knows more about the webpack tool may be of more assistance-- it might not be as complicated as it seems. If you do resolve this we'd be happy to hear how you were able to do it! |
I'm marking this as closed since this isn't an SDK issue. Feel free to open another issue if you have other questions. |
I'm having this same issue. Was a stack overflow ever created? |
+1 i want webpack support too.
it feel so suck. |
This issue isn't specific to this repo, having said that Webpack does not care what you throw at it, you may use Browserify transforms in Webpack. This particular problem looks to be specific to JSON so try adding this to your Webpack config:
module: {
loaders: [
{ test: /\.json$/, loader: 'json' }
]
} If that does not fix everything have a look at google "webpack transform packegify" |
Nope, it doesn't fix it. +1 for webpack support |
+1 for webpack support. This stack overflow question says it has been solved, but I am still seeing errors about Node related stuff. The main errors include the following: |
The same here :-( |
+1 for webpack support. I'm seeing the same problem. |
@prescottprue @rstormsf @dbernstein maybe what you need is no parse it. webpack.conf.js
|
Thanks @geminiyellow for your suggestion: I tried that - no luck. when I run npm install I still get the warnings below. When I try running my code none of the AWS api's are available ( javascript console error = "AWS.SNS is not a function"). It would appear that the messages below are related. If you have any other ideas I would appreciate it. I've been cycling on this for a few hours. WARNING in ./ WARNING in ./ |
I was able to get something working using a solution similiar to @ geminiyellow:
Notice that the regex is for the whole aws-sdk module folder, not just the main |
+1 |
Basically: Install the loaders: Webpack Config:
|
This solution worked for me, but it would be great to see better webpack support in the future. |
Please provide webpack support. |
+1 |
1 similar comment
+1 |
+1 for webpack support. |
+1 |
Is this likely to be reviewed? Webpack is fundamental now to the JavaScript community. |
Webpack support is something we're looking into, but don't currently have an estimate on when work will be completed to support it. I'm reopening this as a feature request for now. |
+1 |
this provides the best work-around so far : http://andrewhfarmer.com/aws-sdk-with-webpack/ basically require('aws-sdk/dist/aws-sdk');
var AWS = window.AWS; instead of |
@deviantony @chrisradek Looks like #1117 needs |
@simonbuchan Could that be because @deviantony's loader is |
@chrisradek Nah, it's the same module, just webpack adds |
@simonbuchan |
@chrisradek Weird? Unless you've changed your |
I've created #1123 that contains all the changes needed to support webpack. It also allows webpack and browserify to be used to generate node bundles as well. Like the other PR, it also allows for importing individual services. I incorporated some of the feedback from the previous PR and resolved some merge conflicts. There shouldn't be anymore major changes, and I think we've settled on the method for requiring services individually. |
@chrisradek I just retried with |
@deviantony |
This works perfectly: import S3 from 'aws-sdk/clients/s3';
const s3 = new S3({...}); Amazing job 👏 |
The PR has been merged and released as part of |
Heads up to other devs If you start getting webpack build errors from ./~/aws-sdk/lib/util.js and have something like
in your webpack config, remove it and the build will work again. |
@chrisradek I keep getting TypeError: Cannot read property 'crypto' of undefined error. Anyone else facing the issue? Thanks |
@rameshsubramanian If you're having trouble getting the SDK to work with webpack, take a look at these blog posts that walk through a simple example and see if they help: |
@rameshsubramanian I was still getting this when I was using
|
Hello, I am using react and I am trying to connect to DynamoDB via aws-sdk. How could this be accomplished ? I have tried the above methods, still cannot set up credentials for dynamo. This works on Javascript but not on React !
|
@kejsiStruga Also, since version 2.6.0 of the SDK, it is no longer necessary to import the SDK from |
@chrisradek I tried this.. But its not working.. I am getting the following error. ERROR in ./ |
I am also getting what @shyamchandranmec is getting, the exact same error. I am at my wits ends trying to figure out how to fix this. I spent two days scouring stack overflow and github issues threads and cannot find any working fixes. Please someone address this! If its any help, I'm using Webpack 2 with TypeScript and React. |
@gerardmrk I have created a npm package with the changes. You can use this until aws developers resolve this. |
@shyamchandranmec and @gerardmrk The error you're reporting isn't one I've seen since before. The error indicates that webpack can't find the lodash dependency on xmlbuilder. Can you check if you are pulling in multiple versions of lodash? My first guess would be webpack isn't correctly resolving the lodash dependency xmlbuilder uses, but any more info you can share would help. Side note: This feature request to support webpack has been closed. Since this is a new error you're seeing, please feel free to open up a new issue. |
@chrisradek I was getting the error when I was importing aws-sdk. This issue was already reported by someone else. Refer this link. Somebody has already raised a pull request but its not merged yet. I have changed the versions of some of the packages. Thats the only change. Updated:
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Has anybody gotten this library to work with webpack? The webpack team recently fixed a ternary require issue which fixed a show stopper.
I was able to fix an issue with loading a JSON file with the
json-loader
. Now I'm getting:Which is causing the individual services to not be included in the packaged bundle.
So doing
new AWS.S3()
returns ais not a function error
.It looks like you might be able to fix this with the
ContextReplacementPlugin
but I'm not sure how to configure it properly for this scenario.Does anybody have any examples or anything?
The text was updated successfully, but these errors were encountered: