SyntaxError: Identifier 'blocks' has already been declared

Created on 30 November 2023, about 1 year ago
Updated 19 December 2023, about 1 year ago

On a fresh install of Gutenberg 3.x-dev, once in the edit mode, you get an uncaught error:
Uncaught SyntaxError: Identifier 'blocks' has already been declared (at index.js:1:1)

We need to avoid global scope pollution, will provide a patch

🐛 Bug report
Status

Needs work

Version

3.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

  • Pipeline finished with Skipped
    over 1 year ago
    #15351
  • Pipeline finished with Skipped
    about 1 year ago
    #45219
  • Pipeline finished with Success
    about 1 year ago
    Total: 145s
    #46473
  • Pipeline finished with Success
    about 1 year ago
    #46475
  • Pipeline finished with Success
    about 1 year ago
    Total: 146s
    #46485
  • Issue created by @doxigo
  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • 🇳🇴Norway eiriksm Norway

    That makes sense, awesome.

    However, I don't think this can be the case for a simple out of the box experience. I can not reproduce it, at least. I guess it happens when you have another JS file that in a similar manner pollutes the global scope with the global variable "block"?

    Can you update the issue summary with exact steps to reproduce on a vanilla drupal install?
    Also, I think it would be nice to have a test for this. Are you able to code up something like that? Or do you need some help? 🤓️✌️

  • Thanks for the quick reply Eirik, I appreciate it 🙌

    I tried again to recreate the issue on a brand new D10 installation, and couldn't. It must've been something on my own project which has tons of custom blocks/etc...

    Regardless, I suppose it doesn't hurt to contain the scope

    and I definitely need help for the tests, thanks 🤩

  • First commit to issue fork.
  • 🇳🇴Norway eiriksm Norway

    @doxigo: Here is an example repo that you can use as a starting point to write some tests: https://github.com/frontkom/drupal-contrib-ddev

    Hope that gets you going? Otherwise happy to help out with more info or guidance ✌️

  • Pipeline finished with Success
    12 months ago
    #72642
  • Pipeline finished with Success
    12 months ago
    #72646
  • Pipeline finished with Skipped
    11 months ago
    #74213
  • Pipeline finished with Success
    10 months ago
    Total: 240s
    #100906
  • Pipeline finished with Success
    10 months ago
    #100930
  • Pipeline finished with Success
    10 months ago
    Total: 358s
    #100934
  • Pipeline finished with Failed
    10 months ago
    Total: 226s
    #101422
  • Pipeline finished with Failed
    10 months ago
    Total: 167s
    #101437
  • Pipeline finished with Success
    10 months ago
    Total: 148s
    #101451
  • Pipeline finished with Skipped
    10 months ago
    #105355
  • Pipeline finished with Failed
    9 months ago
    Total: 155s
    #116538
  • Pipeline finished with Failed
    9 months ago
    Total: 185s
    #116561
  • Pipeline finished with Failed
    9 months ago
    #116577
  • Pipeline finished with Success
    9 months ago
    #116587
  • Pipeline finished with Skipped
    9 months ago
    #138068
  • Pipeline finished with Success
    8 months ago
    Total: 179s
    #141969
  • Pipeline finished with Success
    8 months ago
    Total: 150s
    #141976
  • Pipeline finished with Failed
    8 months ago
    Total: 155s
    #155243
  • Pipeline finished with Success
    8 months ago
    #161171
  • Pipeline finished with Failed
    8 months ago
    Total: 216s
    #161175
  • Pipeline finished with Success
    8 months ago
    Total: 224s
    #161178
  • Pipeline finished with Failed
    7 months ago
    Total: 379s
    #169626
  • Pipeline finished with Canceled
    6 months ago
    #194645
  • Pipeline finished with Success
    6 months ago
    Total: 215s
    #194646
  • Pipeline finished with Canceled
    6 months ago
    Total: 233s
    #194665
  • Pipeline finished with Success
    6 months ago
    Total: 658s
    #194667
  • Pipeline finished with Success
    6 months ago
    Total: 214s
    #205716
  • Pipeline finished with Success
    6 months ago
    Total: 216s
    #205735
  • Pipeline finished with Success
    6 months ago
    Total: 1438254s
    #195923
  • Pipeline finished with Success
    6 months ago
    Total: 322s
    #211612
  • Pipeline finished with Success
    6 months ago
    Total: 222s
    #211620
  • Pipeline finished with Failed
    6 months ago
    #212897
  • Pipeline finished with Manual
    6 months ago
    #213220
  • Pipeline finished with Success
    6 months ago
    #217297
  • Pipeline finished with Success
    6 months ago
    #217301
  • Pipeline finished with Failed
    6 months ago
    Total: 147s
    #217882
  • Pipeline finished with Success
    5 months ago
    Total: 143s
    #232065
  • Pipeline finished with Success
    5 months ago
    #232071
  • Pipeline finished with Success
    5 months ago
    Total: 339s
    #242214
  • Pipeline finished with Skipped
    5 months ago
    #242248
  • Pipeline finished with Success
    4 months ago
    Total: 225s
    #254278
  • Pipeline finished with Failed
    4 months ago
    Total: 524s
    #255582
  • Pipeline finished with Success
    4 months ago
    Total: 111s
    #263440
  • Pipeline finished with Failed
    4 months ago
    Total: 440s
    #264049
  • Pipeline finished with Skipped
    4 months ago
    #269185
  • Pipeline finished with Failed
    4 months ago
    Total: 1568s
    #272191
  • Pipeline finished with Skipped
    3 months ago
    #278429
  • Pipeline finished with Success
    3 months ago
    Total: 209s
    #281230
  • Pipeline finished with Failed
    3 months ago
    #283146
  • Pipeline finished with Failed
    3 months ago
    Total: 475s
    #283154
  • Pipeline finished with Failed
    3 months ago
    Total: 445s
    #283160
  • Pipeline finished with Success
    3 months ago
    Total: 438s
    #283176
  • Pipeline finished with Success
    3 months ago
    Total: 422s
    #283179
  • Pipeline finished with Success
    3 months ago
    Total: 261s
    #283405
  • Pipeline finished with Success
    3 months ago
    Total: 478s
    #283411
  • Pipeline finished with Success
    3 months ago
    Total: 298s
    #283413
  • Pipeline finished with Success
    3 months ago
    Total: 267s
    #283490
  • Pipeline finished with Success
    3 months ago
    Total: 560s
    #283499
  • Pipeline finished with Failed
    3 months ago
    Total: 308s
    #285453
  • Pipeline finished with Success
    3 months ago
    Total: 324s
    #285475
  • Pipeline finished with Success
    3 months ago
    Total: 285s
    #285512
  • Pipeline finished with Success
    3 months ago
    Total: 286s
    #292492
  • Pipeline finished with Failed
    3 months ago
    Total: 224s
    #301428
  • Pipeline finished with Failed
    2 months ago
    Total: 1504s
    #301765
  • Pipeline finished with Success
    2 months ago
    Total: 238s
    #302439
  • Pipeline finished with Success
    2 months ago
    Total: 237s
    #302440
  • Pipeline finished with Success
    2 months ago
    Total: 315s
    #302684
  • Pipeline finished with Failed
    2 months ago
    Total: 1732s
    #303391
  • Pipeline finished with Failed
    2 months ago
    Total: 2544s
    #306412
Production build 0.71.5 2024