-
-
Notifications
You must be signed in to change notification settings - Fork 929
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
build: bundle with esbuild #257
Conversation
@knightly-bot build this |
As I am unfamiliar with the various types of packaging mechanics in NodeJS, I found it helpful to ref this packaging document when reviewing this |
This is missing a README update. |
This also breaks browser builds (or at least any existing documentation for them). What should the migration path be? Is it possible to output to dist backward compatibly? |
This also breaks the docs.
Seems to fix the issue in |
@Shinigami92 I want to ensure we're clear on whether or not this drops support for es5 in browser builds, do you know if it does? |
Oh yeah, I also did know nothing about this before this PR.
Oh yeah, you are right. I will work on that today or tomorrow 👍
Potentially yes, it could break the browser support. That's why I would like to have a I'm thinking about to drop browser support for now and bring it back in later when we found a much better way of async loading in locales. (This may not be that much difficult.)
Oh 😲, thanks I need to have a look into that 👍
I need also to find out. But if we really provide an iife bundle, we can just target |
@damienwebdev Currently we provide |
@Shinigami92 can you doc here the before and after size of the the bundles so that we can compare? |
I checked three things:
Please note that the esbuild process includes cjs and esm but no browser and the main includes cjs and browser but no esm And in addition to that, I'm already thinking about to split manually the locales into it's own folder and fetch them on demand. But this would be definitely something for another PR |
9158971
to
12497d5
Compare
b9f5372
to
3f01940
Compare
I created a test npm package: https://www.npmjs.com/package/@shinigami92/faker/v/6.0.0-alpha.4-test-esbuild-1 It can be tested with https://unpkg.com/@shinigami92/faker@6.0.0-alpha.4-test-esbuild-1/lib/esm/index.js Just create a simple e.g. vite project and use <!DOCTYPE html>
<html>
<body>
<script type="module">
import { faker } from "https://unpkg.com/@shinigami92/faker@6.0.0-alpha.4-test-esbuild-1/lib/esm/index.js";
console.log(faker.name.firstName());
</script>
</body>
</html> with package.json {
"name": "faker-browser-test",
"scripts": {
"test": "vite"
},
"devDependencies": {
"vite": "~2.7.13"
}
} |
3f01940
to
fb8d397
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
No description provided.