Skip to content

Commit b02d40e

Browse files
authored
Missing step to be able to import after running npm link (SharePoint#5234)
* Missing step to be able to import from npm link I noticed that I was not able to import the library module into another webpart project unless I run "gulp build" 1st. If you dont run such command, you will get a tsc error "module is not found" since there is no "lib" folder at all. * Use single quote instead of triple one
1 parent 609fb21 commit b02d40e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/spfx/library-component-tutorial.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ localization_priority: Priority
5656
5757
## How to consume a 3rd party SPFx library (for local testing)
5858
1. Run `npm link` from the root directory of library solution. In this case it would be from the **```corporate-library```** folder.
59+
60+
1. Right after creating the symbolic link to your new spfx library component, do not forget to run at least once `gulp serve`. You need to compile your library component at least once in order to be able to import it as a module into a different project. Remember that the package.json says that `"main": "lib/index.js"`, therefore, that ___location needs to exist prior any **import** attempt.
5961
6062
1. This will create a local npm link to the library with the name which is provided in the ```package.json```.
6163

0 commit comments

Comments
 (0)