File tree 3 files changed +19
-0
lines changed
test/sourcemaps/static-no-script
3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,15 @@ export default class Generator {
149
149
150
150
const { filename } = options ;
151
151
152
+ // special case — the source file doesn't actually get used anywhere. we need
153
+ // to add an empty file to populate map.sources and map.sourcesContent
154
+ if ( ! parts . length ) {
155
+ compiled . addSource ( {
156
+ filename,
157
+ content : new MagicString ( this . source ) . remove ( 0 , this . source . length )
158
+ } ) ;
159
+ }
160
+
152
161
parts . forEach ( str => {
153
162
const chunk = str . replace ( pattern , '' ) ;
154
163
if ( chunk ) addString ( chunk ) ;
Original file line number Diff line number Diff line change
1
+ < p > no moving parts</ p >
Original file line number Diff line number Diff line change
1
+ const fs = require ( 'fs' ) ;
2
+ const path = require ( 'path' ) ;
3
+
4
+ export function test ( { assert, map } ) {
5
+ assert . deepEqual ( map . sources , [ 'input.html' ] ) ;
6
+ assert . deepEqual ( map . sourcesContent , [
7
+ fs . readFileSync ( path . join ( __dirname , 'input.html' ) , 'utf-8' )
8
+ ] ) ;
9
+ }
You can’t perform that action at this time.
0 commit comments