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

Use a build tool to reduce boilerplate code in js/* files and to make final builds smaller #22

Closed
sammdec opened this issue May 30, 2019 · 5 comments

Comments

@sammdec
Copy link

sammdec commented May 30, 2019

Hey there,
so i noticed a couple fo the bugs that have been logged so far are for the most part just issues with missing modules being imported from other files or other similar build related issues.

I was wondering if you would be open to someone contributing a PR that would update the build task to use a tool like rollup to generate all the boilerplate code required thus making the src files a bit easier to read and hopefully less susceptible to small build related bugs sneaking in.

It would also give you out of the box esm builds for modern systems that support import syntax as well as umd builds and cjs builds. I would hope it would relieve some of the burden of these small bugs to give you more chances to work on some more cool features.

I would love to hear your thoughts on this, if you would like to see what the code change would look like I maaaayy have already started the work so let me know.

Thanks

@desandro
Copy link
Member

Hello again! I appreciate this suggestion. I imagine it's frustrating to see the couple issues pop up around module loading, plus all the cruft dealing with module definitions in the code itself. But I prefer to keep on with my style. Thanks, but no thanks!

To elaborate, I prefer using lighter build tools that output near-identical build code rather than relying on heavy-weight bundlers like Webpack or Rollup. It's a trade-off. I'd rather deal with my own broken code than managing build-tool output. I realize it may seem misguided, but after a decade of supporting JS plugins, that's my current preference ¯_(ツ)_/¯

@sammdec
Copy link
Author

sammdec commented May 30, 2019

Yeah that makes and is understandable, thanks for the thoughtful response.

@sammdec sammdec closed this as completed May 30, 2019
@sammdec
Copy link
Author

sammdec commented May 30, 2019

Oh one last other thing @desandro, I didn't go through the code but for some reason the rollup version I made was coming in at 24KB when minified. Maybe there are some tweaks you can make to your build setup that could do the same, if your interested the output is here https://github.com/samjbmason/zdog/blob/build-task/dist/zdog.umd.js

@desandro
Copy link
Member

Dang that's pretty good. Looks like it cleans up the UMD boilerplate stuff. Thanks for putting this together. This has got me re-thinking things.

@sammdec
Copy link
Author

sammdec commented May 30, 2019

Let me know if you wanna discuss things further or tweak parts I would love to contribute to the library however I can.

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

No branches or pull requests

2 participants