Skip to content

Question: Why the esbuild target is fixed to node20 in optimize ? #46

@ysknsid25

Description

@ysknsid25

Hi, @yusukebe @usualoma

What is the reason for fixing the target to node20 in optimize?

target: 'node20',

For example, there seems to be a difference in the build results when the target is node20 and deno1.

Image

So I think it would be good to default to node20 as the optimized version, but allow the user to specify it using a command line argument ?

Acceptable targets are debatable

  • only node and deno LTS version ?
  • all node and deno version ?
    • in this case, How do we treat esm and cjs

Image of implementation

Define type OPTIMIZE_TARGET

const OPTIMIZE_TARGETS = ['deno1', 'deno2', 'node20', 'node22', 'node24'] as const
type OPTIMIZE_TARGET = (typeof OPTIMIZE_TARGETS)[number]

Add -t --target option.

    .option('-t, --target [target]', `target platform (${OPTIMIZE_TARGETS.join(', ')})`, (value) => {
        // validation
    })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions