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

Move all modules to a single file #282

Merged
merged 2 commits into from Sep 11, 2018
Merged

Move all modules to a single file #282

merged 2 commits into from Sep 11, 2018

Conversation

jxnblk
Copy link
Member

@jxnblk jxnblk commented Sep 6, 2018

Moves all source code into a single file, for my sanity.

@TrySound I'm curious to know if this is a viable option to the problem that #258 attempts to solve (with the addition of some babel config changes and updates to the prepare step) – also riffing off of what you did in rebassjs/components#2

I'll likely merge this in regardless, but to clarify the hesitation with adding rollup to all the packages I maintain, I see it like this:

  • Pure Node.js modules didn't use to require a build setup
  • Babel helps make node modules compatible with browsers
  • Adding another dev dependency and config (on top of babel) for small packages is a lot of overhead
  • I think that dependencies should allow consumers to handle their own build setup however they like
  • I want to support tree-shaking and help consumers create the smallest possible bundles they can
  • I want a standardized way to support ES modules and tree shaking across all my projects, if possible

Ideally, packages like this could be written in a standard that wouldn't require any build setup at all, but I understand that we aren't there yet. Any guidance on this would be much appreciated

@codecov-io
Copy link

Codecov Report

Merging #282 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #282   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           5      1    -4     
  Lines         188    185    -3     
=====================================
- Hits          188    185    -3
Impacted Files Coverage Δ
src/index.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 18d7351...9c58a09. Read the comment docs.

@sapegin
Copy link
Contributor

sapegin commented Sep 7, 2018

Correct me if I'm wrong, wouldn't it prevent tree shaking because now everything is in one module?

@TrySound
Copy link
Contributor

TrySound commented Sep 7, 2018

@sapegin Importing from different files is not tree shaking. Bundler is smart enough to omit unused stuff from each module.

@TrySound
Copy link
Contributor

TrySound commented Sep 7, 2018

@jxnblk I'm okay with this if you don't want to introduce rollup. However size-snapshot plugin is necessary to test treeshakability you want to achieve. If you want I could release standalone version.

@jxnblk
Copy link
Member Author

jxnblk commented Sep 7, 2018

Yeah, a dev tool for testing treeshakability is a nice to have

If you want I could release standalone version.

^^ by this do you mean add a plain Node/CLI API to the plugin? or did I misunderstand?

@TrySound
Copy link
Contributor

TrySound commented Sep 7, 2018

Yes just a simple command which will wrap rollup+size snapshot plugin

@flybayer
Copy link
Contributor

flybayer commented Sep 7, 2018

@jxnblk maybe https://github.com/developit/microbundle would be better than rollup for this?

@TrySound
Copy link
Contributor

TrySound commented Sep 7, 2018

@flybayer microbundle is rollup but with some opinionated stuff included.

@jxnblk
Copy link
Member Author

jxnblk commented Sep 7, 2018

@flybayer Yeah, I've tried microbundle (like it conceptually) but doesn't seem to work super well across the packages I've tried it on

@jxnblk jxnblk merged commit 7e7824c into master Sep 11, 2018
@jxnblk jxnblk deleted the single-file branch September 11, 2018 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants