browserify / static-module

convert module usage to inline expressions
MIT License
74 stars 23 forks source link

Add support for unary operators on modules #33

Closed lachenmayer closed 7 years ago

lachenmayer commented 7 years ago

I have been facing the same error as has been reported in #23:

Module build failed: Error: unsupported type for static module: UnaryExpression
at expression:

  !fs

This can be triggered by the following code (similar to the code that breaks in pump):

var fs = require('fs')
if (!fs) console.log('browser')

Once the fix is applied, this will transform to:

if (false) console.log('browser')

static-eval currently does not support typeof or delete operators. It's unclear what should happen in that case, so I've left them 'unsupported' for now. There is a test for that case.