Skip to content

Commit

Permalink
Merge pull request #605 from developit/fix-babel-modern
Browse files Browse the repository at this point in the history
Fix babel modern
  • Loading branch information
developit authored May 8, 2020
2 parents f7d231a + b3cd06e commit e082be1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ export default async function microbundle(inputOptions) {
let out = await series(
steps.map(config => async () => {
const { inputOptions, outputOptions } = config;
inputOptions.cache = cache;
if (inputOptions.cache !== false) {
inputOptions.cache = cache;
}
let bundle = await rollup(inputOptions);
cache = bundle;
await bundle.write(outputOptions);
Expand Down Expand Up @@ -498,6 +500,9 @@ function createConfig(options, entry, format, writeMeta) {

let config = {
inputOptions: {
// disable Rollup's cache for the modern build to prevent re-use of legacy transpiled modules:
cache: modern ? false : undefined,

input: entry,
external: id => {
if (id === 'babel-plugin-transform-async-to-promises/helpers') {
Expand Down
6 changes: 3 additions & 3 deletions test/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1887,8 +1887,8 @@ modern-generators
Build \\"modernGenerators\\" to dist:
234 B: modern-generators.js.gz
207 B: modern-generators.js.br
233 B: modern-generators.modern.js.gz
191 B: modern-generators.modern.js.br
113 B: modern-generators.modern.js.gz
92 B: modern-generators.modern.js.br
233 B: modern-generators.esm.js.gz
191 B: modern-generators.esm.js.br
311 B: modern-generators.umd.js.gz
Expand All @@ -1910,7 +1910,7 @@ exports[`fixtures build modern-generators with microbundle 4`] = `
`;
exports[`fixtures build modern-generators with microbundle 5`] = `
"var e=regeneratorRuntime.mark(r);function r(){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=0;case 1:return e.next=4,r++;case 4:e.next=1;break;case 6:case\\"end\\":return e.stop()}},e)}export default function(){try{var e=r();return Promise.resolve([e.next().value,e.next().value])}catch(e){return Promise.reject(e)}}
"export default async function(){const e=function*(){let e=0;for(;;)yield e++}();return[e.next().value,e.next().value]}
//# sourceMappingURL=modern-generators.modern.js.map
"
`;
Expand Down

0 comments on commit e082be1

Please sign in to comment.