Import existing modules in the VS code plugin extension - node-modules

We're developing a VS Code extensions web plugin using Typescript. We already have a company provided component, which is downloaded in the node_modules folder. But when I'm referring those modules, the application does not start:
How can I use those components in my plugin extension.

From the web view standpoint, there's no Node.js, no VS Code, node_modules or anything you have in the extension you are writing. The content of the web view must be fully self contained. You have to use a bundler (like webpack) to create JS bundles of your application you want to show in the web view, which includes all the source code of the referenced 3rd party libraries.

Related

Officejs - Addin Outlook - SmartAlerts

I developing addin for outlook and i using officejs framework and Yeoman Generator. I use SmartAlerts because with ItemSend event i can't deploy my plugin into Appsource. I have a problem: i would like to call/import my modules from typescript files into launchevent.js, a file to use for event "OnMessageSend". I see on documentation that is not possible.
I tried to create a new bundle but it work only if into file there is a import istruction and in this file i can't use it. How can i do?
Thanks
You may create a new add-in skeleton in TypeScript where you can import the required modules to the event handler's module. The TS compiler will produce the required JS files in the output folder. Webpack links code chunks with web pages. But that is not great idea to mix JS and TS files in the same solution. Use one or another programming language for your solutions. I prefer using TypeScript.

how does spfx get builded? how to build custom spfx generator

I am learning spfx webpart. I open the gulpfile.js file but it only has limited code lines. how can I know the procedure of building spfx webpart?
And I notice that there is a PNP spfx generator. is it possible to create my own custom spfx generator? or involve spfx into my node project?
thanks
SPFx projects are built using a complex Build System that is an npm package. You can find it under node_modules folder under the name - #microsoft/sp-build-web
This package makes use of more packages. You can go into the node_moduels folder and look for packages named #microsoft/gulp-core-build*
The entire build system is built in Object oriented code with lots of classes and interfaces using TypeScript.
If you want to just customize the Build process then you can build custom tasks which are coded in the gulpfile.js.
On good article to learn is at - https://rencore.com/blog/extending-sharepoint-framework-build-process-custom-tasks/

Using Angular libraries in Nativescript code sharing project

I'm trying to migrate an Angular app to a shared codebase with Nativescript using the new #nativescript/schematics, however, I'm having problems importing my Angular library when building the mobile version of the app. I used the angular-cli to create the library (ng generate library).
For the web version, all I had to do was build the library separately using ng build library-name which then allowed me to import it into the main application.
How can I build a mobile version of the library that can be imported into the main application when running tns run ios --bundle? I've already migrated the components and module of the library with appropriate *.tns files.
Any help is appreciated
I had the same problem. Nativescript cli do not have this feature where we can build an angular library into npm package and use it in other projects.
I tried a workaround and it worked for me. Write a script to copy all of your project files into another directory and replace all *.tns.ts, *tns.html and *.tns.scss. files with *.ts, *.html and *.scss respectively. Then build these files using regular ng command. You can add a build configuration for the same in angular.json file to build from the copied directory. I hope it helps.
I'm sorry this is just a hyperlink answer but the space required to answer this, in my opinion, is way too large. I just finished finalizing a repo I've been working on to do exactly this. I have a whole slew of angular web libraries that I now want to make available for use on mobile using NativeScript. I have put everything I have learned so far into this repo and I hope it helps you too.
Thanks for the final push/idea #Rohit, a script for doing what he suggests is in the test-lib/gulpfile.js of this repo.

Visual Studio 2015/2017 +react +typescript

Have anyone found a complete react+typescript-tutorial in Visual Studio 2015/2017 MVC-project that works, from start to finish?
Ive tried to just get the NuGet-packages named "Reactjs Mvc4" and "typescript", created a .tsx-file, and copied some of the .config/package-files(from guide below), but the more I google, the more extra stuff I seem to be needing. In the end gets me different kinds of errors.
This one seems ok. It does produce all .config/.package-files one the correct locations, but it seems to assume you are using VS Code.
Hi check this cool template its good beginning for react typescript redux and router.
JavaScriptServices
You can generate VisualStudio project.
Form GIT:
JavaScriptServices is a set of client-side technologies for ASP.NET Core. It provides infrastructure that you'll find useful if you:
Use Angular / React / Vue / Aurelia / Knockout / etc.
Build your client-side resources using Webpack.
Execute JavaScript on the server at runtime.
Read Building Single Page Applications on ASP.NET Core with JavaScriptServices for more details.
This repo contains:
A set of NuGet/NPM packages that implement functionality for:
Invoking arbitrary NPM packages at runtime from .NET code (docs)
Server-side prerendering of SPA components (docs)
Webpack dev middleware (docs)
Hot module replacement (HMR) (docs)
Server-side and client-side routing integration (docs)
Server-side and client-side validation integration
"Lazy loading" for Knockout apps
A Yeoman generator that creates preconfigured app starting points (guide)
Samples and docs
It's cross-platform (Windows, Linux, or macOS) and works with .NET Core 1.0.1 or later.

.NET Core 1.1 MVC not rendering correctly via VS2017 IDE

I have a simple .NET Core MVC solution based on a standard template which when started via the VS 2017 IDE does not seem to be rendering Bootstrap elements correctly. This happens whether I use IIS Express or Kestrel, and is browser-independent. But when I start it up from the prompt using dotnet run and browse to it manually it's fine. When I view the page source the correctly rendering version is (as per the environments defined in _Layout.cshtml) taking Bootstrap, JQuery et al from a CDN, whereas when run through the IDE it's using Bower\NPM packages under the web root.
I've tried rebuilding the dependencies to no avail. Static files are set. Any pointers as to what else to look at ?
You have to add app.UseStaticFiles(); line to your Startup class so your statics can be served by static files middleware

Resources