-
Notifications
You must be signed in to change notification settings - Fork 228
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
Swagger UI + Webpack: no such file or directory, open 'C:\indexTemplate.html' #90
Comments
Looks like this error is coming from here: Line 32 in cdb6d96
which is strange, it would appear that @azizj1, can you edit |
I added |
I got it to work. I updated my webpack.config.js and added the following:
And now, Thank you! |
One more issue unfortunately, along the same vein. When I build with a
I get a runtime error:
Any thoughts on that? I was able to |
Update: I wrapped the
And I got the following error:
Now I'm a little unsure of where to go from here. |
I am no webpack expert and can only point you to this thread which may or may not help webpack/webpack#1599 |
@azizj1, try Per the docs:
I believe we need the latter here in order for the indexTemplate behavior to work. |
That said... I'm not 100% sure that Is there any particular reason you're using webpack to compile a Node.js application? Generally, you'd use webpack to produce bundles for single-page applications - curious what your use case here is. |
…ger-ui-express. Could not get it to work on dev or prod. See scottie1984/swagger-ui-express#90
If I was to hazard a guess I'd say that Line 88 in cdb6d96
I see you have a lot of other things going on in your app (TypeScript, Babel, etc)... consider setting up a test repo with only webpack, express, and Swagger UI Express, and try to reproduce your issue there. With so many parts, it could be anything. |
So locally, it only works when I have |
Does the library target not need to be |
I have managed to make swagger-ui work with AWS Lambda. Also, __dirname in the webpack configurations should be false. In the webpack.config.js file, inside "plugins" , insert the following - |
I try to test node.__dirname = true, but did not get the expected result, apparently this is due to the features of my build
@azizj1 - How did you manage to make it work on the local machine? |
I can confirm that @elitsi 's solution worked for me. So I added this to the webpack config:
The swagger-dist files have to be next to the lambda handler file. |
@Berger92 - was thinking off adding this to the Readme for future webpack users. |
Whenever I try this, I got this error
Most likely the
|
Closing with solution |
I have an Express app built via
webpack 4.17.2
. It works great until I addswagger-ui-expres
s (v4.0.1). I added swagger to my express app by doing:As soon as I do that, my webpack build crashes with the following error:
I've uploaded a gist with more details on the configuration: webpack.config.js, app.ts, and relevant info from package.json. And another gist with just the
swagger.json
.Node: 8.9.4
Any help would be appreciated.
The text was updated successfully, but these errors were encountered: