저는 js와 ts 파일을 모두 가지고있는 프로젝트에서 일하고 있습니다. 그것들은 하나의 번들 파일로 합쳐지기로되어 있습니다.typescript와 함께 javascript를 하나의 번들로 컴파일하는 방법은 무엇입니까?
나는 꿀꺽 꿀꺽 - 타이프 라이터를 사용하고 있는데 내 구성은 다음과 같습니다 다음 configutation은 JS 파일을 포함 할 때
, 그것은 코드 번들을 생성 gulp.src(cfg.ts_src)
.pipe(sourcemaps.init())
.pipe(typescript({
allowJs: true,
declaration: false,
diagnostics: false,
emitDecoratorMetadata: true,
experimentalDecorators: true,
module: "system",
moduleResolution: "classic",
noImplicitAny: true,
outFile: "./" + cfg.file,
preserveConstEnums: true,
pretty: true,
removeComments: true,
rootDir: "./static/" + cfg.dest,
target: "es5",
}))
.pipe(sourcemaps.write('.', { sourceRoot: "/static/", includeContent: false }))
내가 가진 문제가된다. 그러나 구성에 js 및 ts 파일이 모두있는 경우 typescript는 javascript 파일을 무시하고 ts 파일 만 컴파일합니다.
js 및 ts 파일의 코드가 포함되어 있고 ts 파일의 소스 맵을 여전히 가지고있는 번들을 만들 수 있습니까?
먼저 모든 TS 파일을 컴파일하고 temp dir에 넣은 다음 다른 모든 js 파일과 함께 모든 파일을 묶어보십시오. –
나중에 타이프 스크립트 소스 맵을 사용할 수 있습니까? – gemrey
그냥 모든 파일들로 최종 디렉토리에 복사하십시오. –