Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/inject/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export default function inject(options) {
return {
code,
ast,
map: sourceMap ? magicString.generateMap({ hires: true }) : null
map: null
};
}
const importBlock = Array.from(newImports.values()).join('\n\n');
Expand Down
13 changes: 13 additions & 0 deletions packages/inject/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ test('handles shadowed variables', () => {
compare('shadowing', { $: 'jquery' });
});

test('returns no sourcemap when nothing is injected', () => {
const filename = path.resolve('test/fixtures/shadowing/input.js');
const input = fs.readFileSync(filename, 'utf-8');
const output = inject({ $: 'jquery' }).transform.call(
{ parse: (code) => acorn.parse(code, { sourceType: 'module', ecmaVersion: 9 }) },
input,
filename
);

expect(output.code).toBe(input);
expect(output.map).toBeNull();
});

test('handles shorthand properties', () => {
compare('shorthand', { Promise: ['es6-promise', 'Promise'] });
});
Expand Down