Browse Source

add file property to sourcemaps with plugins

gh-1187
Rich-Harris 8 years ago
parent
commit
1032e75d46
  1. 4
      src/utils/collapseSourcemaps.js

4
src/utils/collapseSourcemaps.js

@ -1,6 +1,6 @@
import { encode } from 'sourcemap-codec'; import { encode } from 'sourcemap-codec';
import error from './error.js'; import error from './error.js';
import { dirname, relative, resolve } from './path.js'; import { basename, dirname, relative, resolve } from './path.js';
class Source { class Source {
constructor ( filename, content ) { constructor ( filename, content ) {
@ -159,6 +159,8 @@ export default function collapseSourcemaps ( bundle, file, map, modules, bundleS
if ( file ) { if ( file ) {
const directory = dirname( file ); const directory = dirname( file );
sources = sources.map( source => relative( directory, source ) ); sources = sources.map( source => relative( directory, source ) );
map.file = basename( file );
} }
// we re-use the `map` object because it has convenient toString/toURL methods // we re-use the `map` object because it has convenient toString/toURL methods

Loading…
Cancel
Save