-
Notifications
You must be signed in to change notification settings - Fork 68
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
Webpack is returning __dirname as '/' #143
Comments
Nevertheless I did also a topic on stackoverflow. As general fixes are not working with it also. Somehow the normal options to configure webpack are modified and most probably i placed the issue in wrong project as this looks like more like nestjs/ng-universal. @kamilmysliwiec is it more swagger or ng-universal issue ? |
I moved this issue under Please, provide a minimal repository which reproduces your issue. |
Hello Kamil, I think I know the issue. Swagger in general has problems with webapck and production serve according to this issue swagger-ui/#90, but the ng-universal bundling is not accepting the configs defined in webpack config. All works fine if disabling swagger in prod. My webpack config is:
My main.ts init on swagger is:
|
Why not? You can simply modify the object returned by |
Well I tried placing :
inside it, but when compiling to prod it throws:
|
This error is thrown by webpack (invalid schema). I don't think that it is related to this package. |
I have same problam, change webpack config can solve this problem
|
Current behavior
When compiling to prod with build:ssr and serve:ssr it seems webpack is returning __dirname as "/" for swagger.
Minimal reproduction of the problem with instructions
Use @nestjs/ng-universal with default webpack config and default swagger config.
Environment
Ubuntu 18.04 and also local on Windows 10.
Node 10.16
Npm 6.9.0
NestJS 6.6.3
NestJS/Swagger 3.1.0
NestJS/ng-universal 2.1.0
Webpack-cli 3.3.7
Exact error im receiving is:
Unhandled Promise rejection: ENOENT: no such file or directory, open '//indexTemplate.html.tpl' ; Zone: <root> ; Task: Promise.then ; Value: { Error: ENOENT: no such file or directory, open '//indexTemplate.html.tpl' at Object.openSync (fs.js:438:3) at Object.readFileSync (fs.js:343:35) at Object.generateHTML (C:\Users\Work\PhpstormProjects\terminal-app\dist\server.js:80659:16) at Function.setupExpress (C:\Users\Work\PhpstormProjects\terminal-app\dist\server.js:79512:39) at Function.setup (C:\Users\Work\PhpstormProjects\terminal-app\dist\server.js:79505:21) at C:\Users\Work\PhpstormProjects\terminal-app\dist\server.js:129:33 at Generator.next (<anonymous>) at fulfilled (C:\Users\Work\PhpstormProjects\terminal-app\dist\server.js:95:58) at Zone.run (C:\Users\Work\PhpstormProjects\terminal-app\dist\server.js:1633:43) errno: -4058, syscall: 'open', code: 'ENOENT', path: '//indexTemplate.html.tpl' } Error: ENOENT: no such file or directory, open '//indexTemplate.html.tpl' at Object.openSync (fs.js:438:3) at Object.readFileSync (fs.js:343:35) at Object.generateHTML (C:\Users\Work\PhpstormProjects\terminal-app\dist\server.js:80659:16) at Function.setupExpress (C:\Users\Work\PhpstormProjects\terminal-app\dist\server.js:79512:39) at Function.setup (C:\Users\Work\PhpstormProjects\terminal-app\dist\server.js:79505:21) at C:\Users\Work\PhpstormProjects\terminal-app\dist\server.js:129:33 at Generator.next (<anonymous>) at fulfilled (C:\Users\Work\PhpstormProjects\terminal-app\dist\server.js:95:58) at ZoneDelegate.invoke (C:\Users\Work\PhpstormProjects\terminal-app\dist\server.js:1874:26) at Zone.run (C:\Users\Work\PhpstormProjects\terminal-app\dist\server.js:1633:43)
I tried doing __dirname: true/false but it seems that webpack-config.factory.d.ts is not accepting this param - so general workaround doesnt work.
The text was updated successfully, but these errors were encountered: