web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

Compiling TypeScript so all imports go in one file

(3) ShareShare
ReportReport
Posted on by

I am working on Dynamics 365 project where individual pages require some code, and I will have multiple main files 1 per page. Each of these will import exported generic classes and I want all the imports including the main file to be compiled into 1 file, without requires or any other fuss.

For example main file 1 is defined:

import {genericClass1} from './blah/genericClass1';
 class Class1  {
        static Method1() {
           //code
           genericClass1.genericMethod1();

        }
    }

For example main file 2 is defined:

import {genericClass1} from './blah/genericClass1';
 class class2  {
        static Method1() {
           //code
           genericClass1.genericMethod1();

        }
    }

GenericClass1 defined as follows

export class GenericClass1 {
        static genericMethod1() {
           //code

        }
}

I want the compiler to spit out, 2 files. 1 for Class, another one Class2 with genericClass definition included in both files. Without any kind of requires includes etc, just plain vanilla browser readable code.

I tired multiple settings for tsc, installed webpack as well nothing seems to be able to help with this.

I have the same question (0)
  • Suggested answer
    kalluu91 Profile Picture
    40 on at
    Check this article for setting up a Typescript project for web resources:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 45 Most Valuable Professional

#2
iampranjal Profile Picture

iampranjal 36

#3
Satyam Prakash Profile Picture

Satyam Prakash 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans