-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Config to exclude files from routing #2930
Comments
I don't quite understand your usecase linked to StackOverflow. An underscore prefix is the blessed way to opt out of routing, having another option causes two ways to do the same thing. Dynamic imports should still work with private modules, so I'm not sure if we need this new option. |
I'm looking for a way to exclude routes, so that I can have extra routes in the project that are not included in a production build. Currently I have a sub-folder So I'd like to do something like this:
Alternatively - and I was surprised to find that this is not possible - I tried this:
(Of course I would have then passed different values depending on dev vs production.) The existing exclusion mechanism using the leading |
Fixed by #3576 Released in 1.0.0-next.249 |
Said like religious fanatic ("blessed"). There is still no way to programmatically control routes or build output in SvelteKit. Whatever freedoms were once in the config file are gone.
Ad infinitum. |
Where did config.kit.routes go and what is the current method of excluding routes from a SvelteKit build? |
It suspect that it was removed when the routing was switched to the If you still need a feature like this, maybe a new issue should be opened (that also explains why you need it). (You can also use the |
Describe the problem
The following directory layout creates an endpoint for
post.spec.js
andpost.md
, and the only way to opt out is to make them private modules with an underscore/dot prefix:Some developers might require the exact layout/naming shown, where:
Describe the proposed solution
Add a configuration option that excludes files.
For example, a
kit.excludes
config could accept an array ofString
,RegExp
, orFunction
.String
- The basename of the file/directory is compared against the string, and it's excluded if matches.RegExp
- The basename of the file/directory is tested against the regular expression, and it's excluded if matches.({ filepath, basename }) => boolean
- The file/directory is excluded if the function returnstrue
.The default would be
[^_.]
to match the current behavior. This also would enable users to override the current behavior, allowing for underscore/dot-prefixed files to be included in routing.Alternatives considered
src/routes
- Defeats requirement 2Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: