microsoft / microsoft/monaco-editor

[Bug] Error: The parameters in nameBuiltin from elixir.js are globally replaced, causing compilation errors.

Open
#4,613 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

I tried version 0.34.0 and encountered this issue. I'm not sure if this issue started occurring after 11.06.2021.

Monaco Editor Playground Code

No response

Reproduction Steps

vite": "^4.4.5", "monaco-editor": "^0.50.0",

From vite.config.ts

export default defineConfig({
  define: {
    __ENV__: JSON.stringify(process.env.NODE_ENV),
  },

From package.json

  "scripts": {
    "dev": "NODE_ENV=dev vite",
    "build:production": "NODE_ENV=production run-p build-only",
    "build:qa": "NODE_ENV=qa run-p build-only",
  },
Actual (Problematic) Behavior
[error] [commonjs--resolver] Unexpected token (93:43) in /opt/jenkins/workspace/6398857-cs-fe-cs-fe-config-infra-newtest/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.js
file: /opt/jenkins/workspace/6398857-cs-fe-cs-fe-config-infra-newtest/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.js:93:43
92:   constants: ["true", "false", "nil"],
93:   nameBuiltin: ["__MODULE__", "__DIR__", ""qa"", "__CALLER__", "__STACKTRACE__"],
94:   operator: /-[->]?|!={0,2}|\*{1,2}|\/|\\\\|&{1,3}|\.\.?|\^(?:\^\^)?|\+\+?|<(?:-|<<|=|>|\|>|~>?)?|=~|={1,3}|>(?:=|>>)...
95:   variableName: /[a-z_][a-zA-Z0-9_]*[?!]?/,
Expected Behavior

No response

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.js alongside vite.config.ts, then run the build command from package.json with the shown NODE_ENV values. Verify whether the generated Elixir language definition is altered during bundling and confirm that the build completes without invalid syntax in nameBuiltin.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.