-
Notifications
You must be signed in to change notification settings - Fork 2
fix: change bundling to support linked libraries #52
base: master
Are you sure you want to change the base?
fix: change bundling to support linked libraries #52
Conversation
069a35a
to
32168e2
Compare
Awesome! Could you add a test case at test/test-index.js for this? Thank you @fahrradflucht! |
Thinking about this a bit more: What's the behaviour for available relative require ids after your change? The intended behaviour is to throw an Error with a descriptive error message. |
I'm not sure if I understand that. Do you mean something like importing a present |
I added a demo branch to patternplate-getting-started to demonstrate the intended behaviour: According to my test the
Does your change affect this behaviour? Currently there are some kinks to sort out about error propagation, so looking at the terminal session patternplate runs in should be the current source of truth for exceptions. |
Okay now I get it. I thought you meant This doesn't get changed by this PR. The expected errors still fire without stopping the server. |
Nice! With a matching test case I'd merge this happily. |
@KnisterPeter I wrote two tests like you suggested (one linked and one unlinked). This isn't Windows proof and the linter fails. However I pushed it because I had the following problem: The linked test that should fail without my change doesn't. This seems to be that case because the symlink isn't resolved at this point which causes the problem this PR tries to solve. But this is the case if you test this in a patternplate app. Do you have any ideas how I could fake this? |
@fahrradflucht There are two problems right now. First of all you have to fix the linter warnings. Second it seems that your createLinkedFakeModule function fails. |
c0858cb
to
775f7fc
Compare
775f7fc
to
0c0d55d
Compare
@KnisterPeter Yes there is a problem permission problem with creating symlinks in the However as I said maybe it's pointless to fix this because the whole approach isn't working. Locally on my machine this test passes before and after my fix which means the test is wrong. This is because if there is just this plugin the resolve algorithm seems to just resolve to |
Remove caching for tests is not a solution anyway. Your test setup should create the state you need to run your tests and afterwards restore the previous state. |
2d9c337 introduced a check that throws if a file is neither in the cache nor contains 'node_modules' in its filename. This results in the bundler throwing on linked dependencies.
This PR removes the check on the filename. If a file can't be resolved patternplate-server won't exit anymore but should still log out errors.