Skip to content
Johnny Oshika edited this page Mar 29, 2021 · 9 revisions

Test Package Locally

To test this package locally, use npm link which creates a symlink from the global npm package repository to the local project folder:

npm link

Terminal will output something like this:

C:\Program Files\nodejs\node_modules\exit-intent-quattro -> C:\Users\{User}\projects\exit-intent-quattro

That's essentially equivalent to installing a package globally with npm install -g.

Now the package can be imported into another project like this:

import exitIntent from 'exit-intent-quattro';

Note: This doesn't always work with npm link as a result of the following error:

Module not found: Can't resolve 'exit-intent-quattro' in 'C:\Users\Johnny\Downloads\exit-intent-demo\src'

In such an instance, copy the contents of this project into the test project's node_modules.

Check:

npm list -g --depth=0

Remove link:

npm uninstall -g exit-intent-quattro 
Clone this wiki locally