Skip to content

Exclude .map extension#245

Closed
dtomasi wants to merge 2 commits intostrongloop:2.xfrom
dtomasi:2.x
Closed

Exclude .map extension#245
dtomasi wants to merge 2 commits intostrongloop:2.xfrom
dtomasi:2.x

Conversation

@dtomasi
Copy link
Copy Markdown

@dtomasi dtomasi commented Apr 11, 2017

Description

If you are using loopback with typescript or any other javascript dialect, it would generate the .map files for the debugger. loopback-boot tries to load these files which ends up into a Syntax-Error.

Related issues

Checklist

  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style
    guide

@slnode
Copy link
Copy Markdown

slnode commented Apr 11, 2017

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@slnode
Copy link
Copy Markdown

slnode commented Apr 11, 2017

Can one of the admins verify this patch?

2 similar comments
@slnode
Copy link
Copy Markdown

slnode commented Apr 11, 2017

Can one of the admins verify this patch?

@slnode
Copy link
Copy Markdown

slnode commented Apr 11, 2017

Can one of the admins verify this patch?

@dtomasi
Copy link
Copy Markdown
Author

dtomasi commented Jun 1, 2017

Would someone give me a response to this at any time? THX

@bajtos bajtos self-assigned this Jun 7, 2017
@bajtos bajtos added the bug label Jun 7, 2017
Copy link
Copy Markdown
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, thank you @dtomasi for the pull request and sorry for the long delay!

Could you please add a unit-test that's failing on the current 2.x branch and that will pass with your fix in place?

It makes me wonder, why is this fix needed at all?
As far as I understand the code in lib/compiler, this "excludedExtensions" map is used to filter out extensions registered in require.extensions. Are you saying that a source-map file extension.map is registered with require?

@bajtos
Copy link
Copy Markdown
Member

bajtos commented Jun 7, 2017

@slnode ok to test

'.json': '.json',
'.node': 'node',
'.map': '.map'
'.map': '.map',
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bajtos This should fix the tests

@dtomasi
Copy link
Copy Markdown
Author

dtomasi commented Jun 12, 2017

@bajtos Thanks for your response.
I think the problem occurs here: https://github.com/strongloop/loopback-boot/blob/2.x/lib/compiler.js#L693

Is a unit-test for this needed yet? getExcludedExtensions is anyhow not tested in the current 2.x ...

@dtomasi
Copy link
Copy Markdown
Author

dtomasi commented Jun 12, 2017

@bajtos I cannot get any information about why theses 2 tests has failed. If you want me to change something at the code-base, let me know.

@dtomasi
Copy link
Copy Markdown
Author

dtomasi commented Jun 23, 2017

@bajtos You are certainly busy, but I want to ask you to have a short review, merge and release this, because I and maybe other have to create workarounds to solve this problem. I would be very happy you could do this soon, because this problem affects a productive application in my case.

Thanks and best regards
Dominik

@bajtos
Copy link
Copy Markdown
Member

bajtos commented Jun 26, 2017

@dtomasi sorry for the delay, I was on a vacation.

I think the problem occurs here: https://github.com/strongloop/loopback-boot/blob/2.x/lib/compiler.js#L693

Is a unit-test for this needed yet? getExcludedExtensions is anyhow not tested in the current 2.x

AFAICT, getExcludedExtensions was added by 07d2769, which does include some unit-tests. Could you PTAL if some of those tests can be used to reproduce the problem you are seeing?


I added console logs to fixFileExtension to understand better what's happening under the hood. Looks like the logic in fixFileExtensions is flawed and it will treat any file with .js.* suffix as if it should have been preferred over the .js file. Your proposed changes will therefore fix only one of the possible sources of this bug.

IIRC, the goal of this method is to convert file.json to file.js (or file.coffee or similar, depending on what files exist). The current implementation looks a bit convoluted to me, I think it should be possible to simplify it and fix the bug along the way.

I want to ask you to have a short review, merge and release this, because I and maybe other have to create workarounds to solve this problem. I would be very happy you could do this soon, because this problem affects a productive application in my case.

I don't want to land a change that's not well understood, because such changes usually increase the maintenance costs.

As a workaround, until a proper fix is created and landed, you can fork loopack-boot and then e.g. change your package.json to install your fork (npm can install from git).

@dtomasi
Copy link
Copy Markdown
Author

dtomasi commented Jun 27, 2017

@bajtos Hope you enjoyed your vacation :-)

I don't want to land a change that's not well understood, because such changes usually increase the maintenance costs.

I absolutely agree in that. I will have a look the next few days and try to provide a proper solution for that.

@bajtos
Copy link
Copy Markdown
Member

bajtos commented Jul 26, 2017

@dtomasi hello, what's the status of this pull request? Are you still keen to work on this fix and get it finished?

@dtomasi
Copy link
Copy Markdown
Author

dtomasi commented Jul 26, 2017

@bajtos Hello, sorry ... I have currently not status updates. Was too busy the last weeks to work on it and also need some time to plug in first.

@dtomasi
Copy link
Copy Markdown
Author

dtomasi commented Jul 26, 2017

@bajtos Hopefully I can have a look next week. Sorry

@bajtos
Copy link
Copy Markdown
Member

bajtos commented Jul 26, 2017

@dtomasi no worries, take your time 😄

@bajtos
Copy link
Copy Markdown
Member

bajtos commented Sep 11, 2017

@dtomasi Ping, are you still keen to get this pull request finished? Should we close it as abandoned?

@slnode
Copy link
Copy Markdown

slnode commented Sep 11, 2017

Can one of the admins verify this patch?

@zbarbuto
Copy link
Copy Markdown
Member

@bajtos This branch has been working for us on our apps. If it is abandoned is there any chance this could be merged and the task of cleaning up the implementation be backlogged?

@dtomasi
Copy link
Copy Markdown
Author

dtomasi commented Sep 13, 2017

@bajtos Sorry for the delay. I´m currently really busy at work. Cannot find some time to go on with this PR. Think we should close this as abandoned.
Best Dominik

@bajtos
Copy link
Copy Markdown
Member

bajtos commented Sep 13, 2017

This branch has been working for us on our apps. If it is abandoned is there any chance this could be merged and the task of cleaning up the implementation be backlogged?

Let's be realistic: if we backlog the cleanup then it will never happen.

Considering the situation, I am ok to land this fix if somebody can add a unit-test to verify it. Can you @zbarbuto take over this work and write the unit-test? It should fail in the current 2.x branch and pass with the fix in place.

I think the .map entry should be also accompanied by a comment explaining that it's a partial fix for a bigger problem and pointing to #245 (comment)

@bajtos bajtos mentioned this pull request Sep 14, 2017
2 tasks
@bajtos
Copy link
Copy Markdown
Member

bajtos commented Sep 14, 2017

Closing in favour of #263

@bajtos bajtos closed this Sep 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants