From ba2bd60f14fb1d600b9841fa60c70781bd6d9b64 Mon Sep 17 00:00:00 2001 From: Stephan de Vries Date: Thu, 30 Jul 2020 23:29:35 +0200 Subject: [PATCH] Rollup: Explicitly set `output.exports` (#1326) --- src/core/create_compilers/RollupCompiler.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/create_compilers/RollupCompiler.ts b/src/core/create_compilers/RollupCompiler.ts index 582d2618e..8ee5c04b7 100644 --- a/src/core/create_compilers/RollupCompiler.ts +++ b/src/core/create_compilers/RollupCompiler.ts @@ -148,8 +148,12 @@ export default class RollupCompiler { } }); - const resp = await bundle.generate({ format: 'cjs' }); - const { code } = resp.output ? resp.output[0] : resp; + const { + output: [{ code }] + } = await bundle.generate({ + exports: 'named', + format: 'cjs' + }); // temporarily override require const defaultLoader = require.extensions['.js']; @@ -161,7 +165,7 @@ export default class RollupCompiler { } }; - const config: any = require(input); + const config: any = require(input).default; delete require.cache[input]; return config;