-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Use default import of fix-path package #14812
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
Conversation
Electron app starts well with this patch. Thanks @msujew! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I verified it with 0d902cc, and it worked well.
From the main
branch (17d4667), I received the same error when I ran npm run all
:
ERROR in ./src-gen/backend/electron-main.js 9:0-19
Module not found: Error: Can't resolve 'fix-path' in '/Users/kittaakos/dev/git/theia/examples/electron/src-gen/backend'
resolve 'fix-path' in '/Users/kittaakos/dev/git/theia/examples/electron/src-gen/backend'
Parsed request is a module
using description file: /Users/kittaakos/dev/git/theia/examples/electron/package.json (relative path: ./src-gen/backend)
resolve as module
/Users/kittaakos/dev/git/theia/examples/electron/src-gen/backend/node_modules doesn't exist or is not a directory
/Users/kittaakos/dev/git/theia/examples/electron/src-gen/node_modules doesn't exist or is not a directory
/Users/kittaakos/dev/git/theia/examples/electron/node_modules doesn't exist or is not a directory
/Users/kittaakos/dev/git/theia/examples/node_modules doesn't exist or is not a directory
looking for modules in /Users/kittaakos/dev/git/theia/node_modules
single file module
using description file: /Users/kittaakos/dev/git/theia/package.json (relative path: ./node_modules/fix-path)
no extension
/Users/kittaakos/dev/git/theia/node_modules/fix-path doesn't exist
.js
/Users/kittaakos/dev/git/theia/node_modules/fix-path.js doesn't exist
.json
/Users/kittaakos/dev/git/theia/node_modules/fix-path.json doesn't exist
.wasm
/Users/kittaakos/dev/git/theia/node_modules/fix-path.wasm doesn't exist
/Users/kittaakos/dev/git/theia/node_modules/fix-path doesn't exist
/Users/kittaakos/dev/git/node_modules doesn't exist or is not a directory
/Users/kittaakos/dev/node_modules doesn't exist or is not a directory
/Users/kittaakos/node_modules doesn't exist or is not a directory
/Users/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, the Electron app starts as expected.
@msujew @jfaltermeier Note that this a webpack-based solution if I'm not mistaken. So we should mark in the changelog that bundling the backend is now mandatory, as otherwise the Electron startup will fail. |
@msujew The previously used |
Issue encountered: eclipse-theia/theia#14804 Another PR updated "fix-path" and caused the issue: eclipse-theia/theia#14781 A fix was done: eclipse-theia/theia#14812 Side-effect of the fix: eclipse-theia/theia#14804 (comment) Fix to address the side-effect: eclipse-theia/theia#14819 Note: the fix for the side-effect was merged on Theia master, and does not help momentariry on the community release 1.58.x, on which it's not currently planned to back-port this fix: eclipse-theia/theia#14819 (comment) We could contribute a PR to back-port the fix, but I do not think this is super important for us - the Theia Electron app is only an example application and permanently switching to a bundled Electron backend does not seem to have any downside. In consequence, this PR includes using the bundled Electron backend, which is a simple webpack config update. If we later notice issues with this, we can roll-back to use the non-bundled backend in the next community release, which will have the fix above. Note about the webpack config update: as suggested, I have deleted the webpack configs and run "theia build" to have them re-created. Then I re-added the small change we need for the time range context menu. The result is a webpack config that's more aligned with the one Theia generates, for both our example Theia apps. Signed-off-by: Marc Dumais <marc.dumais@ericsson.com>
Issue encountered: eclipse-theia/theia#14804 A PR updated "fix-path" and caused the issue: eclipse-theia/theia#14781 A fix was done: eclipse-theia/theia#14812 Side-effect of the fix: eclipse-theia/theia#14804 (comment) Fix to address the side-effect: eclipse-theia/theia#14819 Note: the fix for the side-effect was merged on Theia master, and does not help momentariry on the community release 1.58.x, on which it's not currently planned to back-port this fix: eclipse-theia/theia#14819 (comment) We could contribute a PR to back-port the fix, but I do not think this is super important for us - the Theia Electron app is only an example application and permanently switching to a bundled Electron backend does not seem to have any downside. In consequence, this PR includes using the bundled Electron backend, which is a simple webpack config update. If we later notice issues with this, we can roll-back to use the non-bundled backend in the next community release, which will have the fix above. Note about the webpack config update: as suggested, I have deleted the webpack configs and run "theia build" to have them re-created. Then I re-added the small change we need for the time range context menu. The result is a webpack config that's more aligned with the one Theia generates, for both our example Theia apps. Signed-off-by: Marc Dumais <marc.dumais@ericsson.com>
Issue encountered: eclipse-theia/theia#14804 A PR updated "fix-path" and caused the issue: eclipse-theia/theia#14781 A fix was done: eclipse-theia/theia#14812 Side-effect of the fix: eclipse-theia/theia#14804 (comment) Fix to address the side-effect: eclipse-theia/theia#14819 Note: the fix for the side-effect was merged on Theia master, and does not help momentariry on the community release 1.58.x, on which it's not currently planned to back-port this fix: eclipse-theia/theia#14819 (comment) We could contribute a PR to back-port the fix, but I do not think this is super important for us - the Theia Electron app is only an example application and permanently switching to a bundled Electron backend does not seem to have any downside. In consequence, this PR includes using the bundled Electron backend, which is a simple webpack config update. If we later notice issues with this, we can roll-back to use the non-bundled backend in the next community release, which will have the fix above. Note about the webpack config update: as suggested, I have deleted the webpack configs and run "theia build" to have them re-created. Then I re-added the small change we need for the time range context menu. The result is a webpack config that's more aligned with the one Theia generates, for both our example Theia apps. Signed-off-by: Marc Dumais <marc.dumais@ericsson.com>
Issue encountered: eclipse-theia/theia#14804 A PR updated "fix-path" and caused the issue: eclipse-theia/theia#14781 A fix was done: eclipse-theia/theia#14812 Side-effect of the fix: eclipse-theia/theia#14804 (comment) Fix to address the side-effect: eclipse-theia/theia#14819 Note: the fix for the side-effect was merged on Theia master, and does not help momentariry on the community release 1.58.x, on which it's not currently planned to back-port this fix: eclipse-theia/theia#14819 (comment) We could contribute a PR to back-port the fix, but I do not think this is super important for us - the Theia Electron app is only an example application and permanently switching to a bundled Electron backend does not seem to have any downside. In consequence, this PR includes using the bundled Electron backend, which is a simple webpack config update. If we later notice issues with this, we can roll-back to use the non-bundled backend in the next community release, which will have the fix above. Note about the webpack config update: as suggested, I have deleted the webpack configs and run "theia build" to have them re-created. Then I re-added the small change we need for the time range context menu. The result is a webpack config that's more aligned with the one Theia generates, for both our example Theia apps. Signed-off-by: Marc Dumais <marc.dumais@ericsson.com>
What it does
Closes #14804
Correctly uses the default import of the
fix-path
library. Since the 4.0.0 version is an ESM library, we need to calldefault()
explicitly. Additionally adjusts the imports used in the generated code to ensure that non-hoisting of libraries does not result in errors.How to test
node_modules
, ideally using something likegit clean -xfd
npm i && npm run build:electron && npm run start:electron
Review checklist
Reminder for reviewers