I would like the generated results to be automatically executed following the successful completion of the compilation process, and for that compilation to utilize the configuration corresponding to the specific environment.
"scripts": {
"dev": "tsup --watch --env.NODE_ENV development --onSuccess 'node dist/app.js'"
}
// tsup.config.ts
import { defineConfig } from "tsup";
const isDev = process.env.NODE_ENV === "development";
console.log("isDev", process.env.NODE_ENV);
export default defineConfig({
target: "es2020",
entry: ["lib/app.ts"],
outDir: "dist",
format: ["cjs", "esm"],
dts: !isDev,
minify: !isDev,
clean: true,
sourcemap: isDev
});
result:
Why doesn't the flag --env.NODE_ENV
and the option --onSuccess
take effect?
What should I do?
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too