Skip to content

Platform-specific file extensions #971

Closed Answered by GuilleDF
GuilleDF asked this question in Q&A
Discussion options

You must be logged in to vote

Figured it out! You can set the extensions through the esbuildOptions config:

export default defineConfig([
  // Web bundle
  {
    entry: ["src/index.ts"],
    outDir: 'dist/web',
    esbuildOptions(options) {
      options.resolveExtensions = [".web.ts", ".web.tsx", ".ts", ".tsx"];
    },
  },
  // Native bundle
  {
    entry: ["src/index.ts"],
    esbuildOptions(options) {
      options.resolveExtensions = [".native.ts", ".native.tsx", ".ts", ".tsx"];
    },
  },
]):

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by GuilleDF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant