Compiling dart to separate js files

725 views Asked by At

I am trying angular.dart. When I compile dart to js it generates a single file which is containing my dart code and whole of angular and may be other libraries also. The problem is file size becomes too large ( 1.5L+ lines ). This also means whenever I will make even a small change in my file, whole js file will be changed and hence can't be cached. Is there a way by which I can have different js files: 1 for my code, 1 for angular and for other libraries.

How do you guys slove this problem ?

1

There are 1 answers

2
Fox32 On

The amount of lines has nothing to say about the file size. Is the file really to big?

You could use DefferedLibrary to split up your application into multiple files, but that won't help you as the file are coupled very close to each others and change both after recompiling (due to tree shaking). But this can help your load time as parts of the application can be loaded later on demand.

But if your application is really to big and have slow load times, you may take a look into the MirrorsUsed annotation to exclude mirrors information for parts of your application.