From ad7e7551ec8de64b300bd6b61432ce3290c76d3f Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 25 Oct 2021 11:23:15 +0200 Subject: [PATCH] fix(nitro): import rollup as cjs --- packages/nitro/package.json | 2 +- packages/nitro/src/build.ts | 6 +++--- yarn.lock | 16 +++++++++++++++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/nitro/package.json b/packages/nitro/package.json index 7d5b99209f..9a46176538 100644 --- a/packages/nitro/package.json +++ b/packages/nitro/package.json @@ -57,7 +57,7 @@ "p-debounce": "^4.0.0", "pathe": "^0.2.0", "pretty-bytes": "^5.6.0", - "rollup": "^2.58.0", + "rollup": "^2.58.1", "rollup-plugin-terser": "^7.0.2", "rollup-plugin-visualizer": "^5.5.2", "serve-placeholder": "^1.2.4", diff --git a/packages/nitro/src/build.ts b/packages/nitro/src/build.ts index 0397d4f9b7..4597f1b1c4 100644 --- a/packages/nitro/src/build.ts +++ b/packages/nitro/src/build.ts @@ -1,6 +1,6 @@ import { relative, resolve, join } from 'pathe' import consola from 'consola' -import { rollup, watch as rollupWatch } from 'rollup' +import * as rollup from 'rollup/dist/rollup.js' import fse from 'fs-extra' import { printFSTree } from './utils/tree' import { getRollupConfig } from './rollup/config' @@ -92,7 +92,7 @@ async function _build (nitroContext: NitroContext) { await writeTypes(nitroContext) consola.start('Building server...') - const build = await rollup(nitroContext.rollupConfig).catch((error) => { + const build = await rollup.rollup(nitroContext.rollupConfig).catch((error) => { consola.error('Rollup error: ' + error.message) throw error }) @@ -110,7 +110,7 @@ async function _build (nitroContext: NitroContext) { } function startRollupWatcher (nitroContext: NitroContext) { - const watcher = rollupWatch(nitroContext.rollupConfig) + const watcher = rollup.watch(nitroContext.rollupConfig) let start: number watcher.on('event', (event) => { diff --git a/yarn.lock b/yarn.lock index 0c7025a9ee..2de15530da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2663,7 +2663,7 @@ __metadata: p-debounce: ^4.0.0 pathe: ^0.2.0 pretty-bytes: ^5.6.0 - rollup: ^2.58.0 + rollup: ^2.58.1 rollup-plugin-terser: ^7.0.2 rollup-plugin-visualizer: ^5.5.2 serve-placeholder: ^1.2.4 @@ -17202,6 +17202,20 @@ fsevents@~2.3.2: languageName: node linkType: hard +"rollup@npm:^2.58.1": + version: 2.58.1 + resolution: "rollup@npm:2.58.1" + dependencies: + fsevents: ~2.3.2 + dependenciesMeta: + fsevents: + optional: true + bin: + rollup: dist/bin/rollup + checksum: 66007faedad4745c15b07980feff6f0688e45543e3717da00f84c6f6a524473531a39861715e212f356114ad3b49e6328621376d1a8e5e66c5638e1b5378b27f + languageName: node + linkType: hard + "run-async@npm:^2.4.0": version: 2.4.1 resolution: "run-async@npm:2.4.1"