fix(nitro): import rollup as cjs

This commit is contained in:
Pooya Parsa 2021-10-25 11:23:15 +02:00
parent 071e11498c
commit ad7e7551ec
3 changed files with 19 additions and 5 deletions

View File

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

View File

@ -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) => {

View File

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