diff --git a/package-lock.json b/package-lock.json index d59a9cf..42e8c34 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "Apache-2.0", "dependencies": { "@prismicio/client": "^7.12.0", + "esm-env": "^1.2.1", "vue-router": "^4.5.0" }, "devDependencies": { @@ -4186,6 +4187,12 @@ "node": "*" } }, + "node_modules/esm-env": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.1.tgz", + "integrity": "sha512-U9JedYYjCnadUlXk7e1Kr+aENQhtUaoaV9+gZm1T8LC/YBAPJx3NSPIAurFOC0U5vrdSevnUJS2/wUVxGwPhng==", + "license": "MIT" + }, "node_modules/espree": { "version": "10.3.0", "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", diff --git a/package.json b/package.json index c10d34d..96092ab 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ }, "dependencies": { "@prismicio/client": "^7.12.0", + "esm-env": "^1.2.1", "vue-router": "^4.5.0" }, "devDependencies": { diff --git a/src/PrismicImage.vue b/src/PrismicImage.vue index 5d59aa7..992eeb4 100644 --- a/src/PrismicImage.vue +++ b/src/PrismicImage.vue @@ -5,6 +5,7 @@ import { asImageWidthSrcSet, isFilled, } from "@prismicio/client" +import { DEV } from "esm-env" import { computed, watchEffect } from "vue" import { devMsg } from "./lib/devMsg" @@ -89,7 +90,7 @@ defineOptions({ name: "PrismicImage" }) const { options } = usePrismic() -if (typeof process !== "undefined" && process.env.NODE_ENV === "development") { +if (DEV) { watchEffect(() => { if (typeof props.alt === "string" && props.alt !== "") { console.warn( diff --git a/src/PrismicLink.vue b/src/PrismicLink.vue index 388d862..db66090 100644 --- a/src/PrismicLink.vue +++ b/src/PrismicLink.vue @@ -6,6 +6,7 @@ import { type PrismicDocument, asLinkAttrs, } from "@prismicio/client" +import { DEV } from "esm-env" import { computed, watchEffect } from "vue" import { devMsg } from "./lib/devMsg" @@ -102,7 +103,7 @@ defineOptions({ name: "PrismicLink" }) const { options } = usePrismic() -if (typeof process !== "undefined" && process.env.NODE_ENV === "development") { +if (DEV) { watchEffect(() => { if (props.field) { if (!props.field.link_type) { diff --git a/src/PrismicText.vue b/src/PrismicText.vue index 2d74615..d5f441d 100644 --- a/src/PrismicText.vue +++ b/src/PrismicText.vue @@ -1,6 +1,7 @@