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

Not working with @include #1

Closed
mspoulsen opened this issue Feb 10, 2020 · 4 comments
Closed

Not working with @include #1

mspoulsen opened this issue Feb 10, 2020 · 4 comments

Comments

@mspoulsen
Copy link

Hi,

When I try to use the @include directive like this:

@include "primitives.ne"

foo   -> "foo"

Then I get:

TypeError: Cannot read property '0' of undefined

import grammar from '@/grammar/foo.ne'
^

Is this possible to fix?

Thanks!

@adam1658
Copy link
Owner

Hi @mspoulsen,

I've published a v2 which correctly resolves includes relative to the current file.

It used to (incorrectly in my opinion) resolve them relative to the cwd.

Let me know if you have any further troubles with it.

Thanks,
Adam

@mspoulsen
Copy link
Author

Thanks a lot! Will try it out 👍

@mspoulsen
Copy link
Author

mspoulsen commented Feb 13, 2020

It is working...kind of. I have problems with changes not loading between test runs.

I have a.ne that includes b.ne. When I run test for a.ne then updates in b.ne are not updated between test runs. However, if I compile the ne file and require the .js file it works as expected.

Any chance you now how to fix nearley-loader?
It is not working with @include and nobody seems to be fixing bugs there 😞
kozily/nearley-loader#8

@adam1658
Copy link
Owner

I haven't done a lot of work with nearley. I'll have a look at the include updates issue soon - I've got a few ideas. I suspect that Jest doesn't redo the transform on a.ne when b.ne changes, because it doesn't know that a.ne is affected by b.ne.

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

No branches or pull requests

2 participants