Skip to content

Chunked code runs in wrong order #5142

Description

@Artur-

Describe the bug

With suitable imports, it seems that the following code

import '../utils/boot.js'; // boot.js defines window.JSCompiler_renameProperty

....

   static get observedAttributes() {
     if (!this.hasOwnProperty(JSCompiler_renameProperty('__observedAttributes', this))) {
...

can execute so that observedAttributes is run before the global JSCompiler_renameProperty has been set, resulting in

Uncaught ReferenceError: JSCompiler_renameProperty is not defined
    at Function.get observedAttributes [as observedAttributes] (properties-mixin.js:122)
    at dom-repeat.js:800

This only happens with some specific imports, as shown in the test case.

Reproduction

git clone https://github.com/Artur-/vite-vaadin-problem1.git
cd vite-vaadin-problem1
npm i
npm run dev

Open localhost:3000 and look at the console output. There should be no errors.

System Info

System:
    OS: macOS 11.6
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 290.42 MB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 16.9.1 - /usr/local/bin/node
    Yarn: 1.22.11 - /usr/local/bin/yarn
    npm: 7.21.1 - /usr/local/bin/npm
    Watchman: 2021.09.13.00 - /usr/local/bin/watchman
  Browsers:
    Brave Browser: 93.1.29.81
    Chrome: 94.0.4606.61
    Chrome Canary: 96.0.4656.3
    Firefox: 92.0
    Safari: 15.0
    Safari Technology Preview: 15.4
  npmPackages:
    vite: ^2.5.4 => 2.6.0

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions