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
Using --entryFile flag with webpack doesn't work #2039
Comments
Workarround that we are using is: In "repl": "ENTRY_FILE=repl nest start graphql --watch --entryFile repl" In const path = require('node:path');
module.exports = options => {
const entryFile = process.env.ENTRY_FILE;
const outputDir = path.dirname(options.output.filename);
const sourceDir = path.dirname(options.entry);
const getSourceFile = () => {
if (entryFile) return `${sourceDir}/${entryFile}.ts`;
return options.entry;
};
const getOutputFile = () => {
if (entryFile) return `${outputDir}/${entryFile}.js`;
return options.output.filename;
};
return {
...options,
entry: getSourceFile(),
output: {
...options.output,
filename: getOutputFile(),
},
};
}; |
Hi! Would you like to create a Pull Request to fix that? |
I was looking at the code and i couldn't easily figure out what's going on :( |
@mentos1386 I guess that is due to this: nest-cli/lib/compiler/webpack-compiler.ts Lines 60 to 64 in 86e5e5e
looks like that the |
Let's track this here #2043 |
Is there an existing issue for this?
Current behavior
When using
--entryFile
withnest start
command to specify different file to run (repl.ts
for example) doesn't work as intended when usingwebpack
instead oftsc
.When using custom
webpack.config.js
in following manner to diagnose the issue:We get the following output:
Which indicates that
--entryFile
has no affect on webpack and it continues to compile themain.ts
which is defined innest-cli.json
asentryFile
.Using
nest start --tsc --entryFile repl
works as intended.Minimum reproduction code
https://github.com/mentos1386/nest-cli-entryfile-repro
Steps to reproduce
npm i
npx nest start --entryFile repl
Expected behavior
repl.ts
should be compiled and started.Package version
9.4.0
NestJS version
9.4.0
Node.js version
16
In which operating systems have you tested?
Other
Relates to #1691
The text was updated successfully, but these errors were encountered: