tighten / nova-package-development

A forum for talking about the process of Nova Package Development
52 stars 2 forks source link

Nova JS dependencies pull core file #8

Closed alexbowers closed 5 years ago

alexbowers commented 6 years ago

I was testing out my package, which uses one of the mixins that comes with Nova JS (HasCards.js).

The way that it is pulled in Nova JS examples is using:

import { HasCards } from 'laravel-nova';

however, you can pull in the file using:

import HasCards from 'laravel-nova/src/mixins/HasCards';

and it has a massive filesize saving.

Using the example 1 your export is 80kb larger than the second one. They both do exactly the same thing.

Worth documenting.

alexbowers commented 6 years ago

image

OwenMelbz commented 6 years ago

Is this just from the IDE? Or is it the actual output size?

Would be interesting to see if the editor is just sizing the file path, rather than the outfitted file

alexbowers commented 6 years ago

It is the actual output size too. Verified it with yarn prod

beliolfa commented 6 years ago

In my case. The build size using the destructuring option is 152K and the other one 177K. Do you know why?

import {
  TogglesTrashed,
  PerformsSearches,
  HandlesValidationErrors
} from 'laravel-nova';
// import TogglesTrashed from 'laravel-nova/src/mixins/TogglesTrashed';
// import PerformsSearches from 'laravel-nova/src/mixins/PerformsSearches';
// import HandlesValidationErrors from 'laravel-nova/src/mixins/HandlesValidationErrors';