Skip to content

Instantly share code, notes, and snippets.

@kumavis
Created December 12, 2019 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kumavis/84b30d7a96df8a87981fbd69e32347be to your computer and use it in GitHub Desktop.
Save kumavis/84b30d7a96df8a87981fbd69e32347be to your computer and use it in GitHub Desktop.
lavamoat workaround plugin

use like this:

browserify xyz.js -g ./plugin.js > xyz-bundle.js
const { makeStringTransform } = require('browserify-transform-tools')
module.exports = makeStringTransform('lavamoat-browserify-workarounds', { excludeExtension: ['.json'] }, (content, _, cb) => {
const result = content
// fix html comments
.split('-->').join('-- >')
// fix direct eval
.split(' eval(').join(' (eval)(')
.split('\neval(').join('\n(eval)(')
cb(null, result)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment