Need help with require-from-string?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

floatdrop
238 Stars 33 Forks MIT License 30 Commits 5 Opened issues

Description

Load module from string

Services available

!
?

Need anything else?

Contributors list

# 5,525
http-re...
exec
test-fr...
Babel
18 commits
# 13,638
Vue.js
vue-cli
code-sp...
progres...
1 commit
# 41,728
CSS
Webpack
PHP
express...
1 commit
# 70,204
slick
phantom...
Chrome
Electro...
1 commit
# 177,663
JavaScr...
Babel
HTML
1 commit
# 2,677
JavaScr...
TypeScr...
Node.js
Koa
1 commit
# 106,395
GraphQL
D
cocoapo...
seleniu...
1 commit

require-from-string Build Status

Load module from string in Node.

Install

$ npm install --save require-from-string

Usage

var requireFromString = require('require-from-string');

requireFromString('module.exports = 1'); //=> 1

API

requireFromString(code, [filename], [options])

code

Required
Type:

string

Module code.

filename

Type:

string

Default:
''

Optional filename.

options

Type:

object
appendPaths

Type:

Array

List of

paths
, that will be appended to module
paths
. Useful, when you want to be able require modules from these paths.
prependPaths

Type:

Array

Same as

appendPaths
, but paths will be prepended.

License

MIT © Vsevolod Strukchinsky

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.