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

unexpected behaviour when defining multiple entries inside routesDir #481

Open
vkunz opened this issue Sep 6, 2022 · 0 comments
Open

unexpected behaviour when defining multiple entries inside routesDir #481

vkunz opened this issue Sep 6, 2022 · 0 comments
Labels
bug Something isn't working needs triage

Comments

@vkunz
Copy link
Contributor

vkunz commented Sep 6, 2022

hi,

bug description

Running routify build with the following options does
not override the defaults, but merges the user provided
options with the defaults. This is unexpected.

        const options = {
            routesDir: {
                "foo": "src/routes/foo",
                "bar": "src/routes/bar"
            }
        }

        const routify = new RoutifyBuildtime(options);

        routify.start();

I would have expected routify to create two routes bundles, one
called foo, one called bar.

Instead both default configs and user provided configs are merged,
and routify tries to create three routes bundles, foo, bar and default.

Because I renamed default to foo, src/routes is now empty, thus routify can't find any routes and errors out.

error:
[Routify 3] build triggered by initial
Error: ENOENT: no such file or directory, stat 'src/routes'

I have a test here that demonstrates unexpected behaviour.

I am not sure if deepAssign is actually wrong, or the usage of deepAssign.
It is just the source of the behaviour.

system:
OS: Linux 5.10 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
CPU: (8) x64 Intel(R) Xeon(R) CPU E3-1270 v5 @ 3.60GHz
  
node:
Node: 16.17.0 - /tmp/xfs-6ba2d18b/node
Yarn: 3.2.3 - /tmp/xfs-6ba2d18b/yarn
npm: 8.15.0 - /usr/bin/npm
  
package.json
  - "svelte": "3.50.0"
  - "@roxi/routify": "3.0.0-next.115"
@vkunz vkunz added bug Something isn't working needs triage labels Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant