Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

top-level target option #14893

Open
4 tasks done
danielroe opened this issue Sep 13, 2022 · 3 comments
Open
4 tasks done

top-level target option #14893

danielroe opened this issue Sep 13, 2022 · 3 comments

Comments

@danielroe
Copy link
Member

danielroe commented Sep 13, 2022

Describe the feature

There are quite a few different locations where target is relevant, including within both nitro rollup, nitro esbuild, vite esbuild, vite optimizeDeps esbuild, vite target, etc. (And the vite options are doubled as the config is used both on client and server.)

It would be handy to have a central place to set a build target and have it set in all the appropriate places.

Possibly relevant: #14601

Usage

import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
  target: {
    client: ['es2020'],
    server: ['es2019']
  },
  // or
  build: {
    target: { /* */ }
  }
})

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

@pi0
Copy link
Member

pi0 commented Sep 13, 2022

I like the idea! Only some points:

  • Since both build.* and target are Nuxt 2 options, we might find better namespace. I would suggest clientTarget and serverTarget top level options or buildTarget: { client, server }
  • We need to create a list of supported targets that is limited than ESBuild and is mappable to different bundlers.
  • Possible supported targets will be changed over the time in order to only support ever-green browsers. How do you imagine to handle this?

@marr
Copy link
Contributor

marr commented Sep 22, 2022

I'm also wondering about the vite.build.target setting. I am getting the same error as the creator of the issue linked above, after trying to use arquero in my project.

@manniL
Copy link
Member

manniL commented Sep 23, 2022

Also related: nuxt/framework#7717

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants