Skip to content

Commit

Permalink
fix: build on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
toyobayashi committed Dec 3, 2023
1 parent 72ede48 commit 5232d72
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/ts-transform-emscripten-parse-tools/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type {
} from 'typescript'

import ts = require('typescript')
import { join } from 'path'
import { join, resolve } from 'path'

export interface DefineOptions {
defines?: {
Expand Down Expand Up @@ -736,8 +736,16 @@ function createTransformerFactory (_program: Program, config: DefineOptions): Tr
const injectedSrc = ts.visitEachChild(transformedSrc, transform.functionLikeDeclarationVisitor, context)

const doNotInsertImport = join(__dirname, '../../emnapi/src/core/init.ts')
if (src.fileName === doNotInsertImport) {
return injectedSrc

if (process.platform === 'win32') {
const resolvedFileName = resolve(src.fileName)
if (resolvedFileName === doNotInsertImport) {
return injectedSrc
}
} else {
if (src.fileName === doNotInsertImport) {
return injectedSrc
}
}

let resultSrc = injectedSrc
Expand Down

0 comments on commit 5232d72

Please sign in to comment.