Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I was able to solve below using specifying file name in assets
- webapp.js
- const serverType = opts.serverType || 'http';
- const serverImpl = require(serverType); -> variable inside require
- package.json
- "assets": "lib/server/webapp.js"
- But Im stuck in below
- index.js
- require(TOPIC_SETTINGS[argv.topic].backend);
- require(`processors/${argv.topic}/processor.${processorModule}`)(dbClient));
- package.json
- "assets":"index.js"
- getting below error
- after i taken out dynamic part of the code
- const temp1 = './lib/' + TOPIC_SETTINGS[argv.topic].backend + '.js'
- const DbClient = require(temp1);
- Warning Cannot resolve 'temp1'
- /home/nilesh/index.js
- Dynamic require may fail at run time, because the requested file
- is unknown at compilation time and not included into executable.
- Use a string literal as an argument for 'require', or leave it
- as is and specify the resolved file name in 'scripts' option.
Add Comment
Please, Sign In to add comment