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

Make TypeScript optional #4

Open
dgp1130 opened this issue Jan 11, 2021 · 1 comment
Open

Make TypeScript optional #4

dgp1130 opened this issue Jan 11, 2021 · 1 comment
Labels
feature New feature or request

Comments

@dgp1130
Copy link
Owner

dgp1130 commented Jan 11, 2021

Currently, @bazel/typescript is a required peer dep because we generate ts_library() rules at runtime in user code. However, this is mostly just used as a build abstraction. We should remove unnecessary usages (such as generated entry points) and then allow users to write prerender code as simple JavaScript, opting out of the TypeScript toolchain.

@dgp1130 dgp1130 added the feature New feature or request label Jan 11, 2021
dgp1130 added a commit that referenced this issue Aug 15, 2021
Refs #38, #39, #4.

This allows JS source files to be included in `prerender_component()` and related rules, both for prerendering HTML and as client side scripts. This mostly involved replacing the relevant `ts_library()` targets with `js_library()` targets to compile user code and avoid depending on it from a `ts_library()` which would require `*.d.ts` definitions that the user may not write.

I included support for `*.mjs` and `*.cjs` files, although I have had trouble getting ESM to work with rules_nodejs and `*.mjs` doesn't work for a lot of complicated reasons not related to `prerender_component()`.

Since we need to compile user code with either `ts_library()` or `js_library()`, it means that a given `prerender_component()` target can only compile *all* TypeScript or *all* JavaScript. This is an unfortunate requirement, but not also a reasonable ask of users, so I don't feel too bad for not supporting it.
dgp1130 added a commit that referenced this issue Aug 15, 2021
Refs #38, #39, #4.

This example application only uses `*.js` source files to validate the use case. It includes JavaScript prerendering code, both in a `prerender_page()` and a standalone `prerender_component()`. It also includes JS client-side scripts and validates that they get included in the final bundle *and* are properly tree shaken when not used.
dgp1130 added a commit that referenced this issue Aug 15, 2021
Refs #38, #39, #4.

This example application only uses `*.js` source files to validate the use case. It includes JavaScript prerendering code, both in a `prerender_page()` and a standalone `prerender_component()`. It also includes JS client-side scripts and validates that they get included in the final bundle *and* are properly tree shaken when not used.
dgp1130 added a commit that referenced this issue Aug 28, 2021
Refs #38, #39, #4.

This example application only uses `*.js` source files to validate the use case. It includes JavaScript prerendering code, both in a `prerender_page()` and a standalone `prerender_component()`. It also includes JS client-side scripts and validates that they get included in the final bundle *and* are properly tree shaken when not used.
dgp1130 added a commit that referenced this issue Aug 28, 2021
Refs #38, #39, #4.

This example application only uses `*.js` source files to validate the use case. It includes JavaScript prerendering code, both in a `prerender_page()` and a standalone `prerender_component()`. It also includes JS client-side scripts and validates that they get included in the final bundle *and* are properly tree shaken when not used.
dgp1130 added a commit that referenced this issue Aug 28, 2021
Refs #38, #39, #4.

This example application only uses `*.js` source files to validate the use case. It includes JavaScript prerendering code, both in a `prerender_page()` and a standalone `prerender_component()`. It also includes JS client-side scripts and validates that they get included in the final bundle *and* are properly tree shaken when not used.
dgp1130 added a commit that referenced this issue Aug 28, 2021
Refs #38, #39, #4.

This example application only uses `*.js` source files to validate the use case. It includes JavaScript prerendering code, both in a `prerender_page()` and a standalone `prerender_component()`. It also includes JS client-side scripts and validates that they get included in the final bundle *and* are properly tree shaken when not used.
dgp1130 added a commit that referenced this issue Aug 28, 2021
Refs #38, #39, #4.

This example application only uses `*.js` source files to validate the use case. It includes JavaScript prerendering code, both in a `prerender_page()` and a standalone `prerender_component()`. It also includes JS client-side scripts and validates that they get included in the final bundle *and* are properly tree shaken when not used.
dgp1130 added a commit that referenced this issue Aug 28, 2021
Refs #38, #39, #4.

This example application only uses `*.js` source files to validate the use case. It includes JavaScript prerendering code, both in a `prerender_page()` and a standalone `prerender_component()`. It also includes JS client-side scripts and validates that they get included in the final bundle *and* are properly tree shaken when not used.
dgp1130 added a commit that referenced this issue Aug 28, 2021
Refs #38, #39, #4.

This example application only uses `*.js` source files to validate the use case. It includes JavaScript prerendering code, both in a `prerender_page()` and a standalone `prerender_component()`. It also includes JS client-side scripts and validates that they get included in the final bundle *and* are properly tree shaken when not used.
@dgp1130
Copy link
Owner Author

dgp1130 commented Feb 14, 2023

Just to note, we currently require @aspect_rules_ts as a workspace-level dependency. We should make this optional so that if the workspace never uses TypeScript, it doesn't need this dependency.

rules_ts_dependencies(ts_version_from = "@rules_prerender//:package.json")

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

No branches or pull requests

1 participant