fix(bridge): detect conflict with @nuxt/typescript-build usage (#672)

This commit is contained in:
Daniel Roe 2021-10-06 17:39:13 +02:00 committed by GitHub
parent 2fc0829dd2
commit ac16127a13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) => {