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

fix: update imports in examples for v11 #2363

Merged
merged 8 commits into from
May 17, 2024

Conversation

rachel-fenichel
Copy link
Collaborator

@rachel-fenichel rachel-fenichel commented May 16, 2024

The basics

The details

Resolves

Fixes #2364

Proposed Changes

For each plugin that has issues with imports when updated to v11:

  • Install v11.0.0.beta-12
  • Update imports to stop using default imports

Reason for Changes

Handle breaking change made in v11.

Test Coverage

Tested manually

@rachel-fenichel rachel-fenichel requested a review from a team as a code owner May 16, 2024 22:15
@rachel-fenichel rachel-fenichel requested review from BeksOmega and removed request for a team May 16, 2024 22:15
@BeksOmega
Copy link
Contributor

BeksOmega commented May 16, 2024

Since #2362 covers three classes of issues, can you split it up into three issues? [Edit, that way we can close it, which is more visible in the github project]

@@ -1,6 +1,6 @@
<script>
import { onMount } from 'svelte';
import Blockly from 'blockly';
import * as Blockly from 'blockly';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should import each thing it needs individually as specified here. If you don't want to fix that now, feel free to file a bug to follow up.

Here and in Vue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't need the generators, but I do need to have core, library blocks, and english langfiles.

I updated the imports to

  import * as Blockly from 'blockly/core';
  import * as libraryBlocks from 'blockly/blocks';
  import * as En from 'blockly/msg/en';

and added a call to Blockly.setLocale(En). This (and the inject) call fail because Blockly is undefined.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I applied the same change to the Vue example and it worked fine. Do you know what the difference is? @cpcallen to comment as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Vue demo is built using Vite. The Svelte demo is built using rollup. Gonna guess some of the packaging changes aren't compatible with our rollup config, but our config is also pretty out of date (e.g. we're using some commonjs plugin whose git repo was archived 3 years ago) so who knows where the problem lies. This probably warrants Christopher's eyes.

I would probably start by trying a new rollup config from scratch if they have an updated hello world example.

I'll also note that rollup says it is the bundler behind Vite, so the fact that it works over there seems promising. More likely to point to a problem in our specific rollup config than a deeper incompatibility

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by updating the version of rollup and some of their plugins. Refreshingly, everything that needed to be replaced or updated was clearly labeled.

examples/blockly-react/package.json Show resolved Hide resolved
@rachel-fenichel
Copy link
Collaborator Author

@BeksOmega this is ready for re-review.
Changes I made:

  • Updated dependencies and import statements for vue example
  • Went back to latest (instead of beta) in react demo, to avoid a peer dependency conflict with the date field
  • Formatted

Copy link
Contributor

@BeksOmega BeksOmega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet! I don't know enough about any of these frameworks to approve in the truest sense. But sounds like you worked through a bunch of stuff. And this isn't load bearing code. So LGTM

@rachel-fenichel rachel-fenichel merged commit ba1d4f5 into google:rc/v11.0.0 May 17, 2024
7 checks passed
@rachel-fenichel rachel-fenichel deleted the test_examples branch May 17, 2024 22:23
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

Successfully merging this pull request may close these issues.

3 participants