简体   繁体   中英

Browserify: expressions in require statements - how to make it work?

I'm setting up browserify on an existing lib and one of its dependencies does something like this:

require('./path/to/' + module);

Browserify is complaining about require statements containing expressions. Given I know the exhaustive list of values the variable module can get assigned to, can I tell browserify to bundle those libraries?

You can bundle.require() the modules directly server-side so long as you don't mind the warnings about expressions in require() printed to stderr.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM