fix: cloudflare and polyfill

This commit is contained in:
Pooya Parsa 2020-11-20 13:14:16 +01:00
parent 15fff5117f
commit cb98031cff
2 changed files with 6 additions and 2 deletions

View File

@ -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)
}
}
})

View File

@ -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