UNPKG

418 BJavaScriptView Raw
1module.exports = function() {
2 const { watch } = this.query || {}
3 const outFile = this.resourcePath.replace(/\.(re|ml)$/, '.bs.js')
4 const fs = this.fs || require('fs')
5 try {
6 fs.statSync(outFile)
7 return `export * from ${JSON.stringify(outFile)}`
8 } catch (_) {
9 throw new Error(
10 `Cannot find ${outFile}\nYou must run \`bsb -make-world${
11 watch ? ' -w' : ''
12 }\` first.`
13 )
14 }
15}