[javascript] Added README section for Webpack configuration (closes #3466) (#5767)

This commit is contained in:
Vlad Frolov
2017-06-04 10:42:41 +03:00
committed by wing328
parent 034fc44bdd
commit 54f5d73ee2
6 changed files with 156 additions and 6 deletions

View File

@@ -24,7 +24,7 @@ npm install swagger_petstore --save
```
#### git
#
If the library is hosted at a git repository, e.g.
https://github.com/GIT_USER_ID/GIT_REPO_ID
then install it via:
@@ -66,6 +66,31 @@ api.fakeOuterBooleanSerialize(opts).then(function(data) {
```
### Webpack Configuration
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader:
1. Add `imports-loader` package:
```bash
npm install --save-dev imports-loader
```
2. Add the following sections to your webpack config (replace `MY_API_CLIENT_NAME` with your module name):
```javascript
module: {
rules: [
{
test: /MY_API_CLIENT_NAME[\/\\]+.*\.js$/,
use: 'imports-loader?define=>false'
}
]
},
node: {
fs: 'empty'
}
```
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io:80/v2*