sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Issue in Building dll-code in SharePoint Framework

Open MaheshakaMudli opened this issue 9 years ago • 8 comments

I went through the below link for Building dll-code in SharePoint Framework. everything worked well but the library added contains a single method with data returning as string.

https://blog.mastykarz.nl/dll-code-sharepoint-framework/

If we want to import angular or jQuery in the library file in the example shown above, how can we do it?

MaheshakaMudli avatar Dec 21 '16 12:12 MaheshakaMudli

Have you tried doing it the same way as you would in a regular web part, ie. using import or require statements?

waldekmastykarz avatar Jan 02 '17 06:01 waldekmastykarz

Yes I did tried by using import and require. The code breaks when we gulp build it and it gives error as typescript.d.ts file could not find the module jquery or angular.

MaheshakaMudli avatar Jan 02 '17 07:01 MaheshakaMudli

Have you installed TypeScript typings for jquery/angular in your project?

waldekmastykarz avatar Jan 02 '17 07:01 waldekmastykarz

Yes i have installed typescript for jquery/angular......

MaheshakaMudli avatar Jan 02 '17 13:01 MaheshakaMudli

The issue occurs when we run the script written for automatically updating the typescript.d.ts file whose code is written in gulp.js file. Command : gulp build typingsfilename At that moment it is not able to find the module jquery/angular... Any help would be greatly appreciated as we have been stuck in middle of it...

MaheshakaMudli avatar Jan 03 '17 04:01 MaheshakaMudli

Could you try removing this line and see if it helps https://github.com/waldekmastykarz/spfx-sample-dllcode/blob/b3fe3e208d7271f5f52b64cd66522207ccb4ee1c/gulpfile.js#L40?

waldekmastykarz avatar Jan 05 '17 18:01 waldekmastykarz

In order to use jQuery (and other libraries) in SPFx, you should go to the following article: https://dev.office.com/sharepoint/docs/spfx/web-parts/basics/add-an-external-library

Considering this is months old and there hasn't been any update in either side, I'll close the thread.

mpasarin avatar May 04 '17 21:05 mpasarin

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 30 '20 00:01 msft-github-bot