Skip to content

Commit

Permalink
Wire up --context CLI flag (#3134)
Browse files Browse the repository at this point in the history
Fixes #3121
  • Loading branch information
tchetwin authored and lukastaegert committed Sep 26, 2019
1 parent a261cad commit 4b69c09
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/mergeOptions.ts
Expand Up @@ -213,7 +213,7 @@ function getInputOptions(
acornInjectPlugins: config.acornInjectPlugins as any,
cache: getOption('cache'),
chunkGroupingSize: getOption('chunkGroupingSize', 5000),
context: config.context as any,
context: getOption('context'),
experimentalCacheExpiry: getOption('experimentalCacheExpiry', 10),
experimentalOptimizeChunks: getOption('experimentalOptimizeChunks'),
experimentalTopLevelAwait: getOption('experimentalTopLevelAwait'),
Expand Down
4 changes: 4 additions & 0 deletions test/cli/samples/context/_config.js
@@ -0,0 +1,4 @@
module.exports = {
description: 'Uses --context to set `this` value',
command: 'rollup main.js --format commonjs --context window'
};
6 changes: 6 additions & 0 deletions test/cli/samples/context/_expected.js
@@ -0,0 +1,6 @@
'use strict';

console.log(window);
var main = 42;

module.exports = main;
2 changes: 2 additions & 0 deletions test/cli/samples/context/main.js
@@ -0,0 +1,2 @@
console.log(this);
export default 42;

0 comments on commit 4b69c09

Please sign in to comment.