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

use correct reh/reh-web package.json in bundle #6028

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

jmcphers
Copy link
Collaborator

This change addresses an issue in which Positron Server doesn't start due to an error like this one:

(node:11206) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/home/ubuntu/vscode-reh-web-linux-x64/out/server-main.js:26
export function __extends(d, b) {
^^^^^^

SyntaxError: Unexpected token 'export'
    at wrapSafe (node:internal/modules/cjs/loader:1378:20)
    at Module._compile 

The problem was caused by an incompletely merged line in the initial 1.95 merge, which caused a cascade of silent failures that led to package.json being omitted from the reh-web bundle, which led to the above failure since package.json was responsible for setting "type": "module" as noted above. The fix is just to update the line to match what it was before the merge:

// --- Start Positron ---
// Note: The remote/reh-web/package.json is generated/updated in build/npm/postinstall.js
const packageJsonBase = type === 'reh-web' ? 'remote/reh-web' : 'remote';
const packageJsonStream = gulp.src([`${packageJsonBase}/package.json`], { base: packageJsonBase })
.pipe(json({ name, version, dependencies: undefined, optionalDependencies: undefined, ...(isESM(`Setting 'type: module' in top level package.json`) ? { type: 'module' } : {}) })) // TODO@esm this should be configured in the top level package.json
// --- End Positron ---

Addresses, coincidentally, #5775, which is where this error was first spotted.

After the change, it ought to be possible to run ./positron-server without error. E.g.:

./positron-server --version
Positron: 2025.01.1 build 4
Positron SHA: 9f520e6e796d266fcd603d601ae904e2abae8f9f
Code OSS: 1.96.0
Arch: arm64

Copy link

E2E Tests 🚀  ?
This PR will run tests tagged with: @critical

@jmcphers jmcphers requested a review from sharon-wang January 16, 2025 22:26
Copy link
Contributor

@melissa-barca melissa-barca left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@sharon-wang sharon-wang left a comment

Choose a reason for hiding this comment

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

Built reh-web locally and was able to do the following 👌

./positron-server --version
Positron: 2025.01.1 build 5
Positron SHA: d9090524f0920b313e1b6f085ca3db0fde1551ac
Code OSS: 1.96.0
Arch: x64

@jmcphers jmcphers merged commit 9dc2127 into prerelease/2025.01 Jan 17, 2025
3 of 6 checks passed
@jmcphers jmcphers deleted the bugfix/2025.01-package.json branch January 17, 2025 16:43
@github-actions github-actions bot locked and limited conversation to collaborators Jan 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants