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

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

Open
1 of 2 tasks
Wendydesigner opened this issue Jul 26, 2024 · 1 comment

Comments

@Wendydesigner
Copy link

Wendydesigner commented Jul 26, 2024

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

@Wendydesigner
Copy link
Author

The patch has been applied, and the compilation succeeded.

diff --git a/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.js b/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.js
index c7fa54b..2edaec3 100644
--- a/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.js
    b/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.js
@@ -92,7  92,7 @@ var language = {
     "with"
   ],
   constants: ["true", "false", "nil"],
-  nameBuiltin: ["__MODULE__", "__DIR__", "__ENV__", "__CALLER__", "__STACKTRACE__"],
   nameBuiltin: ["__MODULE__", "__DIR__", __ENV__, "__CALLER__", "__STACKTRACE__"],
   // Matches any of the operator names:
   // <<< >>> ||| &&& ^^^ ~~~ === !== ~>> <~> |~> <|> == != <= >= && || \\ <>    -- |> =~ -> <- ~> <~ :: .. = < >   - * / | . ^ & !
   operator: /-[->]?|!={0,2}|\*{1,2}|\/|\\\\|&{1,3}|\.\.?|\^(?:\^\^)?|\ \ ?|<(?:-|<<|=|>|\|>|~>?)?|=~|={1,3}|>(?:=|>>)?|\|~>|\|>|\|{1,3}|~>>?|~~~|::/,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant