Skip to content

Commit

Permalink
Merge pull request #1337 from krisselden/fix-cache-loader-sourcemaps
Browse files Browse the repository at this point in the history
Fix cache losing originalSourceMap for loaders with sourcemaps
  • Loading branch information
Rich-Harris committed Mar 16, 2017
2 parents ae9eb5c + d94d8c2 commit 7c8c6ba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Module.js
Expand Up @@ -373,6 +373,7 @@ export default class Module {
dependencies: this.dependencies.map( module => module.id ),
code: this.code,
originalCode: this.originalCode,
originalSourceMap: this.originalSourceMap,
ast: this.astClone,
sourceMapChain: this.sourceMapChain,
resolvedIds: this.resolvedIds
Expand Down
14 changes: 13 additions & 1 deletion test/test.js
Expand Up @@ -454,7 +454,7 @@ describe( 'rollup', function () {
process.chdir( SOURCEMAPS + '/' + dir );
warnings = [];

return rollup.rollup( options ).then( bundle => {
const testBundle = (bundle) => {
const options = extend( {}, {
format: profile.format,
sourceMap: true,
Expand All @@ -473,6 +473,18 @@ describe( 'rollup', function () {
} else if ( warnings.length ) {
throw new Error( `Unexpected warnings` );
}
};

return rollup.rollup( options ).then(bundle => {
testBundle(bundle);
// cache rebuild does not reemit warnings.
if ( config.warnings ) {
return;
}
// test cache noop rebuild
return rollup.rollup( extend({ cache: bundle }, options) ).then(bundle => {
testBundle(bundle);
});
});
});
});
Expand Down

0 comments on commit 7c8c6ba

Please sign in to comment.