Title: Fails at import statement with "with" or "assert" · Issue #1256 · javascript-obfuscator/javascript-obfuscator · GitHub
Open Graph Title: Fails at import statement with "with" or "assert" · Issue #1256 · javascript-obfuscator/javascript-obfuscator
X Title: Fails at import statement with "with" or "assert" · Issue #1256 · javascript-obfuscator/javascript-obfuscator
Description: Expected Behavior The obsufcator sees this as normal js code. Current Behavior Currently it fails at import statements using "with" like: import config from "../../config.json" with { type: "json" }; or import config from "../../config.j...
Open Graph Description: Expected Behavior The obsufcator sees this as normal js code. Current Behavior Currently it fails at import statements using "with" like: import config from "../../config.json" with { type: "json" ...
X Description: Expected Behavior The obsufcator sees this as normal js code. Current Behavior Currently it fails at import statements using "with" like: import config from "../../config.json" ...
Opengraph URL: https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1256
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fails at import statement with \"with\" or \"assert\" ","articleBody":"\u003c!-- Love javascript-obfuscator? Please consider supporting our collective:\r\n👉 https://opencollective.com/javascript-obfuscator/donate --\u003e\r\n\r\n\u003c!--- Provide a general summary of the issue in the Title above --\u003e\r\n\r\n## Expected Behavior\r\nThe obsufcator sees this as normal js code.\r\n\r\n## Current Behavior\r\nCurrently it fails at import statements using \"with\" like:\r\n```js\r\nimport config from \"../../config.json\" with { type: \"json\" };\r\n\r\nor\r\n\r\nimport config from \"../../config.json\" assert{ type: \"json\" };\r\n```\r\n\r\n## Steps to Reproduce\r\n\u003c!--- Provide a link to a live example, or an unambiguous set of steps to --\u003e\r\n\u003c!--- reproduce this bug. Include code to reproduce, if relevant --\u003e\r\n1. create a index.js\r\n2. import file using \"with\" operator\r\n3. run obfuscator\r\n4. see it fail\r\n\r\n## Your Environment\r\n\u003c!--- Include as many relevant details about the environment you experienced the bug in --\u003e\r\n* Obfuscator version used: ^4.1.0\r\n* Node version used: v20.13.1\r\n\r\n# Stack trace\r\n```\r\nError: ERROR at line 12: Unexpected token (12:39)\r\n\u003e ..../config.json\" with { type: \"j...\r\n at Function.processParsingError (C:\\Users\\Bamad\\WebstormProjects\\BirdieAI\\src\\node_modules\\javascript-obfuscator\\dist\\webpack:\\javascript-obfuscator\\src\\ASTParserFacade.ts:77:15)\r\n at Function.parse (C:\\Users\\Bamad\\WebstormProjects\\BirdieAI\\src\\node_modules\\javascript-obfuscator\\dist\\webpack:\\javascript-obfuscator\\src\\ASTParserFacade.ts:43:49)\r\n at o.parseCode (C:\\Users\\Bamad\\WebstormProjects\\BirdieAI\\src\\node_modules\\javascript-obfuscator\\dist\\webpack:\\javascript-obfuscator\\src\\JavaScriptObfuscator.ts:87:50)\r\n at obfuscate (C:\\Users\\Bamad\\WebstormProjects\\BirdieAI\\src\\node_modules\\javascript-obfuscator\\dist\\webpack:\\javascript-obfuscator\\src\\JavaScriptObfuscator.ts:78:30)\r\n at Function.obfuscate (C:\\Users\\Bamad\\WebstormProjects\\BirdieAI\\src\\node_modules\\javascript-obfuscator\\dist\\webpack:\\javascript-obfuscator\\src\\JavaScriptObfuscatorFacade.ts:16:56)\r\n at copyAndObfuscate (file:///C:/Users/Bamad/WebstormProjects/BirdieAI/src/builder/builder.js:57:54)\r\n at build (file:///C:/Users/Bamad/WebstormProjects/BirdieAI/src/builder/builder.js:34:5)\r\n at file:///C:/Users/Bamad/WebstormProjects/BirdieAI/src/builder/builder.js:98:1\r\n at ModuleJob.run (node:internal/modules/esm/module_job:222:25)\r\n at ModuleLoader.import (node:internal/modules/esm/loader:316:24)\r\n```\r\n\r\n## Minimal working example that will help to reproduce issue\r\n\r\nJust put `import config from \"../../config.json\" with { type: \"json\" };` in any file.","author":{"url":"https://github.com/Timtendo12","@type":"Person","name":"Timtendo12"},"datePublished":"2024-05-26T16:51:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/1256/javascript-obfuscator/issues/1256"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8b859e31-0ba7-070b-7266-a9b88e1801ce |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C3AE:1213B9:357914:4E8975:6A62F5D0 |
| html-safe-nonce | aad47abb96685df4bed64c9f1a9b9c8879308736da67305c0a828e56d3e0164d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDM0FFOjEyMTNCOTozNTc5MTQ6NEU4OTc1OjZBNjJGNUQwIiwidmlzaXRvcl9pZCI6IjU4NDY5ODk4MTIyMTQ3MjQwNDgiLCJyZWdpb25fZWRnZSI6Indlc3R1czIiLCJyZWdpb25fcmVuZGVyIjoid2VzdHVzMiJ9 |
| visitor-hmac | 5c1a502d2d6642b20132405c3a2020fdee11fde5fb02503a32f40164b53c2983 |
| hovercard-subject-tag | issue:2317844214 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/javascript-obfuscator/javascript-obfuscator/1256/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dc495fe217a3e5b5449e3ba641855ab8b1be51f79f77d14ce48fd9a84e20e22b/javascript-obfuscator/javascript-obfuscator/issues/1256 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dc495fe217a3e5b5449e3ba641855ab8b1be51f79f77d14ce48fd9a84e20e22b/javascript-obfuscator/javascript-obfuscator/issues/1256 |
| og:image:alt | Expected Behavior The obsufcator sees this as normal js code. Current Behavior Currently it fails at import statements using "with" like: import config from "../../config.json" with { type: "json" ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Timtendo12 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b415018e190e73858133ddcaa36acce7b3f3572fe54dda84bd3b21a6ec714c30 |
| turbo-cache-control | no-preview |
| go-import | github.com/javascript-obfuscator/javascript-obfuscator git https://github.com/javascript-obfuscator/javascript-obfuscator.git |
| octolytics-dimension-user_id | 23015672 |
| octolytics-dimension-user_login | javascript-obfuscator |
| octolytics-dimension-repository_id | 58360147 |
| octolytics-dimension-repository_nwo | javascript-obfuscator/javascript-obfuscator |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 58360147 |
| octolytics-dimension-repository_network_root_nwo | javascript-obfuscator/javascript-obfuscator |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 22f98521e99f504294ab0812b66104d50eb75a70 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width