From cb98031cff942b14d71e12f751a17be165972bac Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 20 Nov 2020 13:14:16 +0100 Subject: [PATCH] fix: cloudflare and polyfill --- packages/nitro/src/presets/cloudflare.ts | 6 +++++- packages/nitro/src/rollup/config.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/nitro/src/presets/cloudflare.ts b/packages/nitro/src/presets/cloudflare.ts index 43715ac0fb..cc6a2603dd 100644 --- a/packages/nitro/src/presets/cloudflare.ts +++ b/packages/nitro/src/presets/cloudflare.ts @@ -13,7 +13,11 @@ export const cloudflare: SigmaPreset = extendPreset(worker, { async 'sigma:compiled' ({ output, _nuxt }: SigmaContext) { await writeFile(resolve(output.dir, 'package.json'), JSON.stringify({ private: true, main: './server/index.js' }, null, 2)) await writeFile(resolve(output.dir, 'package-lock.json'), JSON.stringify({ lockfileVersion: 1 }, null, 2)) - consola.success('Ready to run `wrangler publish` in', prettyPath(_nuxt.rootDir)) + let inDir = prettyPath(_nuxt.rootDir) + if (inDir) { + inDir = 'in ' + inDir + } + consola.success('Ready to run `wrangler publish`', inDir) } } }) diff --git a/packages/nitro/src/rollup/config.ts b/packages/nitro/src/rollup/config.ts index a939feb191..a4dfd1abd4 100644 --- a/packages/nitro/src/rollup/config.ts +++ b/packages/nitro/src/rollup/config.ts @@ -132,7 +132,7 @@ export const getRollupConfig = (sigmaContext: SigmaContext) => { // Polyfill rollupConfig.plugins.push(virtual({ - '~polyfill': env.polyfill.map(p => `require('${p}');`).join('\n') + '~polyfill': env.polyfill.map(p => `import '${p}';`).join('\n') })) // https://github.com/rollup/plugins/tree/master/packages/alias