From ac16127a13e8282d7a7b5fa3e56b8fbf9cc64b1b Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 6 Oct 2021 17:39:13 +0200 Subject: [PATCH] fix(bridge): detect conflict with `@nuxt/typescript-build` usage (#672) --- packages/bridge/src/typescript.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/bridge/src/typescript.ts b/packages/bridge/src/typescript.ts index f638dad87e..af6feaef0b 100644 --- a/packages/bridge/src/typescript.ts +++ b/packages/bridge/src/typescript.ts @@ -13,6 +13,12 @@ export function setupTypescript () { const _require = createRequire(import.meta.url) const babelPlugin = _require.resolve('@babel/plugin-transform-typescript') nuxt.options.build.babel.plugins = nuxt.options.build.babel.plugins || [] + + // Error if `@nuxt/typescript-build` is added + if (nuxt.options.buildModules.includes('@nuxt/typescript-build')) { + throw new Error('Please remove `@nuxt/typescript-build` from `buildModules` or set `bridge.typescript: false` to avoid conflict with bridge.') + } + nuxt.options.build.babel.plugins.unshift(babelPlugin) extendWebpackConfig((config) => {