Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Rollup -private as part of prepublish #6051

Closed
runspired opened this issue Apr 20, 2019 · 4 comments
Closed

[FEAT] Rollup -private as part of prepublish #6051

runspired opened this issue Apr 20, 2019 · 4 comments

Comments

@runspired
Copy link
Contributor

runspired commented Apr 20, 2019

EmberData usesRollup to merge all of our -private directories into single modules.
-private represents a single module organized as many modules for maintenance ease.
This benefits us in three ways:

  • It reduces the scope of potential private API's and modules being leaked for use by consuming applications
  • This greatly improved our parse time by having a single module instead of many modules (mostly via a reduction in the number of scopes and closures involved).
  • It reduces our bundle size significantly (some dead-code-elimination but mostly via the more advanced minification that a single module allows and elimination of lots of module declarations that would otherwise be present)

It also comes with a few drawbacks:

  • consuming applications pay the cost of the rollup step (as much as 3-5seconds)
  • embroider has to let EmberData do a double pass in order to receive our addon output

We should make all of the packages rollup their -private directories as a prepublish step such that consuming applications get a single -private module when they install one of our packages and don't pay the cost of rollup at all.

This will also make things play nicer with embroider because embroider will not need to run our build step before being able to construct the graph correctly, as our modules will be in the correct form by the time embroider sees them in consuming applications.

The rollup output should be an ES Module with as minimal transpilation done as possible so that we can respect the target of consuming applications. Getting the babel config right such that EmberData's needs and consuming app targets are both respected will likely be the more difficult bit here.

@richard-viney
Copy link

Not sure if this is related, but with ember-data@3.11.0-beta.1 we're currently seeing:

'@ember-data/store/-private' is imported by ../../../../tmp/broccoli-13026pikMS34IzFf3/cache-274-rollup/build/-private/index.js, but could not be resolved – treating it as an external dependency
'@ember-data/store' is imported by ../../../../tmp/broccoli-13026pikMS34IzFf3/cache-274-rollup/build/-private/index.js, but could not be resolved – treating it as an external dependency
'@ember-data/model' is imported by ../../../../tmp/broccoli-13026pikMS34IzFf3/cache-274-rollup/build/-private/system/debug/debug-adapter.js, but could not be resolved – treating it as an external dependency

@runspired
Copy link
Contributor Author

#6180 resolves the warnings and restores rollup but we still need to do the pre-publish

@runspired runspired removed the blocking label Aug 1, 2019
@runspired runspired changed the title Restore rollup step of -private as part of prepublish Rollup -private as part of prepublish Sep 27, 2019
@runspired runspired changed the title Rollup -private as part of prepublish [FEAT] Rollup -private as part of prepublish Sep 27, 2019
@runspired runspired added the CI label Nov 5, 2019
@runspired
Copy link
Contributor Author

@dcyriller is going to look into this as part of better preparing ember-data for embroider

@runspired
Copy link
Contributor Author

closing in favor of #8103 tracking this, @ember-data/tracking is an example of a library now doing this. #8285 is another example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants