Skip to content

Commit 629f09f

Browse files
committed
fix(core): Check for dev mode via process.env.NODE_ENV
1 parent 071fd5c commit 629f09f

File tree

1 file changed

+8
-3
lines changed
  • packages/bundler-plugin-core/src

1 file changed

+8
-3
lines changed

packages/bundler-plugin-core/src/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ export function sentryUnpluginFactory({
8484
debug: userOptions.debug ?? false,
8585
});
8686

87+
// Not a bulletproof check but should be good enough to at least sometimes determine
88+
// if the plugin is called in dev/watch mode or for a prod build. The important part
89+
// here is to avoid a false positive. False negatives are okay.
90+
const isDevMode = process.env["NODE_ENV"] === "development";
91+
8792
try {
8893
const dotenvFile = fs.readFileSync(
8994
path.join(process.cwd(), ".env.sentry-build-plugin"),
@@ -106,7 +111,7 @@ export function sentryUnpluginFactory({
106111

107112
const options = normalizeUserOptions(userOptions);
108113

109-
if (unpluginMetaContext.watchMode || options.disable) {
114+
if (isDevMode || options.disable) {
110115
return [
111116
{
112117
name: "sentry-noop-plugin",
@@ -274,7 +279,7 @@ export function sentryUnpluginFactory({
274279
"Release injection disabled via `release.inject` option. Will not inject release."
275280
);
276281
} else if (!options.release.name) {
277-
logger.warn(
282+
logger.debug(
278283
"No release name provided. Will not inject release. Please set the `release.name` option to identify your release."
279284
);
280285
} else {
@@ -316,7 +321,7 @@ export function sentryUnpluginFactory({
316321
}
317322

318323
if (!options.release.name) {
319-
logger.warn(
324+
logger.debug(
320325
"No release name provided. Will not create release. Please set the `release.name` option to identify your release."
321326
);
322327
} else if (!options.authToken) {

0 commit comments

Comments
 (0)