🚀 Feature Request: Make bundling and rules 2 different concepts #6944
Labels
discussion
This issue is being used to discuss a topic rather than track a feature or bug.
enhancement
New feature or request
esbuild
) that isrules
from 1 above are ignore and all the imports are inlined.As of today 1 and 2 are grouped around a single "Bundling" paradigm.
That is:
wrangler deploys
will activate 2 and ignore 1wrangler deploys --no-bundle
will activate 1 and skip 1 (esbuild)I believe 1 and 2 should be different concepts and not mutually exclusive.
For example you could have you framework composed of multiple files and then a directory containing the different pages of your application.
In that case it would be nice to bundle the app into a single file (2) and being able to require the page matching the url (1).
Updating ESBuild could solve some of the use case with wildcard imports.
workerd recently introduced
createRequire
. You can now write:The code works fine with
--no-bundle
- as long as thehello.cjs
has a matching rule in wrangler.toml.However the code will fail without
--no-bundle
because it can not resolvehello.cjs
.If
require
is passed a variable, the code will fail to build because of the dynamic require.That's why I believe we should be able to bundle the app/framework but still have module that you can require.
If both 1 and 2 can be used together, files matched by a rules must be marked as external so that
esbuild
does not try to inline them./cc @IgorMinar
The text was updated successfully, but these errors were encountered: