fix(bridge): support newer js targets with webpack (#3131)

This commit is contained in:
Daniel Roe 2022-02-08 16:13:02 +00:00 committed by GitHub
parent 0f9bcbf68f
commit a9ba1ca907
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -18,6 +18,8 @@
"prepack": "unbuild" "prepack": "unbuild"
}, },
"dependencies": { "dependencies": {
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
"@babel/plugin-transform-typescript": "^7.16.8", "@babel/plugin-transform-typescript": "^7.16.8",
"@nuxt/kit": "3.0.0", "@nuxt/kit": "3.0.0",
"@nuxt/nitro": "3.0.0", "@nuxt/nitro": "3.0.0",

View File

@ -10,8 +10,6 @@ export function setupTypescript () {
nuxt.options.extensions.push(...extensions) nuxt.options.extensions.push(...extensions)
nuxt.options.build.additionalExtensions.push(...extensions) nuxt.options.build.additionalExtensions.push(...extensions)
const _require = createRequire(import.meta.url)
const babelPlugin = _require.resolve('@babel/plugin-transform-typescript')
nuxt.options.build.babel.plugins = nuxt.options.build.babel.plugins || [] nuxt.options.build.babel.plugins = nuxt.options.build.babel.plugins || []
// Error if `@nuxt/typescript-build` is added // Error if `@nuxt/typescript-build` is added
@ -19,7 +17,12 @@ export function setupTypescript () {
throw new Error('Please remove `@nuxt/typescript-build` from `buildModules` or set `bridge.typescript: false` to avoid conflict with bridge.') 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) const _require = createRequire(import.meta.url)
nuxt.options.build.babel.plugins.unshift(
_require.resolve('@babel/plugin-proposal-optional-chaining'),
_require.resolve('@babel/plugin-proposal-nullish-coalescing-operator'),
_require.resolve('@babel/plugin-transform-typescript')
)
extendWebpackConfig((config) => { extendWebpackConfig((config) => {
config.resolve.extensions!.push(...extensions.map(e => `.${e}`)) config.resolve.extensions!.push(...extensions.map(e => `.${e}`))

View File

@ -2565,6 +2565,8 @@ __metadata:
version: 0.0.0-use.local version: 0.0.0-use.local
resolution: "@nuxt/bridge@workspace:packages/bridge" resolution: "@nuxt/bridge@workspace:packages/bridge"
dependencies: dependencies:
"@babel/plugin-proposal-nullish-coalescing-operator": ^7.16.7
"@babel/plugin-proposal-optional-chaining": ^7.16.7
"@babel/plugin-transform-typescript": ^7.16.8 "@babel/plugin-transform-typescript": ^7.16.8
"@nuxt/kit": 3.0.0 "@nuxt/kit": 3.0.0
"@nuxt/nitro": 3.0.0 "@nuxt/nitro": 3.0.0