Webpack compile issue
See original GitHub issueI have installed swagger-parser@3.4.1
and trying to validate my api using parser.validate("swaggerJson")
but getting webpack compile issue
Here is the code …
SwaggerParser = require('swagger-parser');
validateResult: string;
swaggerSpec ;
constructor(private http: Http, private service: DifferencesService){
let parser = new this.SwaggerParser();
service.getSwaggerSpec().subscribe(
result => { this.swaggerSpec = result;},
error => { console.log(error); }
);
parser.validate(this.swaggerSpec)
.then(function(api) {
this.validateResult = "Yay! The API is valid.";
console.log('Yay! The API is valid.');
})
.catch(function(err) {
this.validateResult = 'Onoes! The API is invalid. ' + err.message;
console.error('Onoes! The API is invalid. ' + err.message);
});
Here is the Error …
ERROR in ./~/swagger-parser/lib/validate-schema.js
Module not found: Error: Can't resolve 'swagger-schema-official/schema' in 'D:\gitmyworkspace\mywork\pcfdeploy\node_modules\swagger-parser\lib'
@ ./~/swagger-parser/lib/validate-schema.js 6:20-61
@ ./~/swagger-parser/lib/index.js
@ ./src/app/components/swagger-validate.component.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts
ERROR in ./~/swagger-parser/lib/promise.js
Module not found: Error: Can't resolve 'es6-promise' in 'D:\gitmyworkspace\mywork\pcfdeploy\node_modules\swagger-parser\lib'
@ ./~/swagger-parser/lib/promise.js 4:59-81
@ ./~/swagger-parser/lib/index.js
@ ./src/app/components/swagger-validate.component.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts
ERROR in ./~/json-schema-ref-parser/lib/promise.js
Module not found: Error: Can't resolve 'es6-promise' in 'D:\gitmyworkspace\mywork\pcfdeploy\node_modules\json-schema-ref-parser\lib'
@ ./~/json-schema-ref-parser/lib/promise.js 4:59-81
@ ./~/json-schema-ref-parser/lib/index.js
@ ./~/swagger-parser/lib/index.js
@ ./src/app/components/swagger-validate.component.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts
webpack: Failed to compile.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
reactjs - Webpack Compilation Error - Stack Overflow
You're using babel-loader in your webpack config, but you don't have it installed. Well you might have it installed, but it's not in...
Read more >How I solved and debugged my Webpack issue through trial ...
When webpack bundles your source code, it can become difficult to track down errors and warnings to their original location.
Read more >'webpack compiled with 1 error' when npm starts #12410
This is just a warning that is usually given when a new updated package either of react or any other dependency has been...
Read more >Development | webpack
When using automatic compilation of your code, you could run into issues when saving your files. Some editors have a "safe write" feature...
Read more >Change the way webpack compile warnings are surfaced
Configure some way to surface these warnings with danger or some allowed-to-fail job which inspects the webpack output to ensure compile issues ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I got the same error and my solution is: “
import * as SwaggerParser from 'swagger-parser/dist/swagger-parser';
”. Inspired by: https://github.com/BigstickCarpet/swagger-parser/issues/48. It works in my project, wish it can help you.I have pointed to the browser distributed file by adding it in
angular-clli.json
where I have pointed for other js filesHere is my
SwaggerComponent
Still getting same issue.