From d735b6c26a48f60f390d763cfbd5f3c0448fbb05 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 13 Jul 2022 11:01:29 +0100 Subject: [PATCH] fix: throw error if wrapper isn't used --- src/module.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/module.ts b/src/module.ts index 8b9d79494..2e4d836b0 100644 --- a/src/module.ts +++ b/src/module.ts @@ -36,7 +36,9 @@ export default defineNuxtModule({ // Disable if users explicitly set to false if ((nuxt.options as any).bridge === false) { return } - const _require = createRequire(import.meta.url) + if (!(nuxt.options as any).bridge._version) { + throw new Error('[bridge] Bridge must be enabled by using `defineNuxtConfig` to wrap your Nuxt configuration.') + } if (opts.nitro) { nuxt.hook('modules:done', async () => { @@ -63,6 +65,7 @@ export default defineNuxtModule({ nuxt.options.build.transpile.push('vue') } if (opts.postcss8) { + const _require = createRequire(import.meta.url) await installModule(_require.resolve('@nuxt/postcss8')) } if (opts.typescript) {