Skip to content

Commit

Permalink
fix: fallback to load file from fs
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Apr 28, 2021
1 parent 7d75cc1 commit fc216bc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fs from 'fs'
import { build, Loader } from 'esbuild'
import path from 'path'
import { PluginContext, Plugin, LoadResult, TransformResult } from 'rollup'
Expand Down Expand Up @@ -44,6 +45,7 @@ export const bundle = async (
write: false,
sourcemap: true,
outdir: 'dist',
platform: 'node',
plugins: [
{
name: 'rollup',
Expand Down Expand Up @@ -88,7 +90,7 @@ export const bundle = async (
}

if (contents == null) {
return undefined
contents = await fs.promises.readFile(args.path, 'utf8')
}

const transformed = await transform(contents, args.path)
Expand Down

0 comments on commit fc216bc

Please sign in to comment.