Skip to content

Commit

Permalink
check if dir and file exists before generate bundle (#236)
Browse files Browse the repository at this point in the history
Solves for my own case darionco/rollup-plugin-web-worker-loader#4

Which generates a new configuration for the worker which, when inlined, has not file or directory and rollup-plugin-postcss tries to compile it and crashes
  • Loading branch information
GerardRodes authored Feb 27, 2020
1 parent 18cf215 commit 271c120
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ export default (options = {}) => {
},

async generateBundle(opts, bundle) {
if (extracted.size === 0) return
if (
extracted.size === 0 ||
!(opts.dir || opts.file)
) return

// TODO: support `[hash]`
const dir = opts.dir || path.dirname(opts.file)
Expand Down

0 comments on commit 271c120

Please sign in to comment.