@@ -6,13 +6,10 @@ import rollup from 'rollup'
6
6
import path from 'path'
7
7
import fs from 'fs-extra'
8
8
import ts from 'typescript'
9
- import { RawSourceMap , SourceMapConsumer } from 'source-map'
9
+ import type { RawSourceMap } from 'source-map'
10
10
import merge from 'merge-source-map'
11
- import {
12
- Extractor ,
13
- ExtractorConfig ,
14
- ExtractorResult ,
15
- } from '@microsoft/api-extractor'
11
+ import type { ExtractorResult } from '@microsoft/api-extractor'
12
+ import { Extractor , ExtractorConfig } from '@microsoft/api-extractor'
16
13
import yargs from 'yargs/yargs'
17
14
18
15
import { extractInlineSourcemap , removeInlineSourceMap } from './sourcemap'
@@ -201,12 +198,14 @@ async function bundle(options: BuildOptions & EntryPointOptions) {
201
198
const origin = chunk . text
202
199
const sourcemap = extractInlineSourcemap ( origin )
203
200
const result = ts . transpileModule ( removeInlineSourceMap ( origin ) , {
201
+ fileName : chunk . path . replace ( / .j s $ / , '.ts' ) ,
204
202
compilerOptions : {
205
203
sourceMap : true ,
206
204
module :
207
205
format !== 'cjs' ? ts . ModuleKind . ES2015 : ts . ModuleKind . CommonJS ,
208
206
target : esVersion ,
209
207
} ,
208
+ fileName : chunk . path
210
209
} )
211
210
212
211
const mergedSourcemap = merge ( sourcemap , result . sourceMapText )
@@ -217,7 +216,11 @@ async function bundle(options: BuildOptions & EntryPointOptions) {
217
216
const transformResult = await terser . minify (
218
217
appendInlineSourceMap ( code , mapping ) ,
219
218
{
220
- sourceMap : { content : 'inline' , asObject : true } as any ,
219
+ sourceMap : {
220
+ content : 'inline' ,
221
+ asObject : true ,
222
+ url : path . basename ( chunk . path ) + '.map' ,
223
+ } as any ,
221
224
output : {
222
225
comments : false ,
223
226
} ,
0 commit comments