Preloading NodeJS Module in NextJs

Viewed 118

I have a next js application and I want to preload a Node JS module while starting next js application

I am using below script to pre-load a module in next js

(please note -r option , tried to use -r from node ecosystem)

But it is not working and it says - Unknown or unexpected option: -r

"dev": "next -r 'module' dev"

Can anybody please help in how to preload a nodejs module in next js app ?

1 Answers

You can do this:

node --require module node_modules/next/dist/bin/next dev
Related