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

Include SECURITY_NAMESPACE handling in Vite builds #58

Open
SebastienGllmt opened this issue Jan 22, 2024 · 0 comments
Open

Include SECURITY_NAMESPACE handling in Vite builds #58

SebastienGllmt opened this issue Jan 22, 2024 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@SebastienGllmt
Copy link
Contributor

SebastienGllmt commented Jan 22, 2024

Currently, the logic to replace SECURITY_NAMESPACE based on the contents of the file it points to (if it points to a file) is just top-level code in the @paima/build-utils code

It may be useful to export these settings in a more easy-to-consume way for projects that want to bypass the standard Paima build system and instead hook into their own esbuild process.

Notably for Vite, it uses esbuild (but only in dev builds - production builds use @rollup/plugin-commonjs). We can't just do something simple like import esbuildConfigs from '@paima/build-utils/middleware-esbuildconfig.template'; because of ES module import hoisting (we can require instead, or if we have a vite plugin for Paima we can ensure proper ordering there)

Therefore, there are two steps to this:

  1. Figure out how we can export the esbuild template configs in a way Vite can use for dev builds
  2. Figure out how we can export the SECURITY_NAMESPACE_ROUTER computation in a way that works with rollup

Given that SECURITY_NAMESPACE_ROUTER is a rare feature to actually need, I'm leaving this open for now

I should at that with this we should also be able to delete the npx paima-build-middleware building in the vite templates since it won't be needed anymore (it's already unused, but strictly speaking the SECURITY_NAMESPACE_ROUTER only works there for now if you really needed it)

@SebastienGllmt SebastienGllmt added the help wanted Extra attention is needed label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant