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

extensions-sdk v9.22.3 breaking change under certain (unknown) conditions #17529

Closed
eifachnurtobi opened this issue Feb 15, 2023 · 4 comments · Fixed by #17539
Closed

extensions-sdk v9.22.3 breaking change under certain (unknown) conditions #17529

eifachnurtobi opened this issue Feb 15, 2023 · 4 comments · Fixed by #17539

Comments

@eifachnurtobi
Copy link

eifachnurtobi commented Feb 15, 2023

Describe the Bug

When updating the EditorJs Interface from extensions-sdk v9.22.1 to v9.22.3 an uncodumented change seems to break the extension. The message SyntaxError: Unexpected identifier 'exports' appears in the console.
It seems to occur on {get exports(){return T$1},set exports(e){T$1=e;}}.exports=function(e){...}, however i am not sure what exactly causes it.
This snippet does not appear in the code when compiling with extensions-sdk v9.22.1, instead it is compiled as T$1.exports = function(e) {...}

To Reproduce

Install directus-extension-editorjs-interface, update extensions-sdk in package.json to v9.22.1 and compile. The extension works as epected.
Change version to v9.22.3, compile again, and the extension will not load, showing the error messages below. Worryingly, this also causes the other installed interface extensions to not work.

Errors Shown

Error 1 (in browser console): Couldn't load extensions
Error 2 (in browser console): SyntaxError: Unexpected identifier 'exports' (at index.js:...)

What version of Directus are you using?

9.22.4

What version of Node.js are you using?

18, from official directus docker container

What database are you using?

MySQL

What browser are you using?

Chrome

How are you deploying Directus?

Docker

@github-actions
Copy link

Linear: ENG-699

@rijkvanzanten
Copy link
Member

@freekrai and I ran into the same problem today. We've identified it to be caused by an update in @rollup/plugin-terser (from 0.2.x to 0.4.x). Currently investigating what changes in there are affecting us 🙂

@eifachnurtobi
Copy link
Author

Thanks, that indeed seems to be the case. As a temporary fix i have found that you can run the build with the --no-minify option, to prevent terser from being run.
I also found that using the --sourcemap option, a warning is generated that 'terser transformed the files, but did not generate a sourcemap', which is counterintuitive since generating sourcemap seems to have been the whole point of the terser plugin v0.3.0 release.

@paescuj
Copy link
Member

paescuj commented Feb 16, 2023

@eifachnurtobi Turns out the issue is related to newer versions of @rollup/plugin-commonjs where the terser must have some issues to minify the code correctly. See also #17539.

Would you be able to confirm this by overriding the version in your package.json file? Thanks!

  // npm
  "overrides": {
    "@rollup/plugin-commonjs": "23.0.4"
  }

  // pnpm
  "pnpm": {
    "overrides": {
      "@rollup/plugin-commonjs": "23.0.4"
    }
  }

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants