creativecommons / chooser

The new and improved CC license selection tool.
https://chooser-beta.creativecommons.org
MIT License
104 stars 137 forks source link

[Bug] Issue with localization package #408

Closed MuluhGodson closed 2 years ago

MuluhGodson commented 2 years ago

Description

Opening the License Page on the staging environment for project_creativecommons.org displays a blank page with the console error:

i18n.js:4 Uncaught TypeError: Cannot read properties of undefined (reading 'use')
    at Object.9225 (i18n.js:4:5)
    at r (bootstrap:63:22)
    at Object.199c (App.vue:60:1)
    at r (bootstrap:63:22)
    at Module.23be (App.vue?1160:1:1)
    at r (bootstrap:63:22)
    at Module.3dfd (App.vue:1:1)
    at r (bootstrap:63:22)
    at Object.a7c1 (main.js:2:1)
    at r (bootstrap:63:22)

I cloned the latest version of this repo and got the same error on my local dev environment. However, npm run serve works and displays correctly.

cc @brylie

Reproduction

  1. npm install
  2. npm run build-component
  3. Start a local server and serve the newly created demo.html file in the dist folder [with python3 you can start a local server with python3 -m http.server]
  4. Open console and See error.

Expectation

License Chooser should display correctly.

Resolution

brylie commented 2 years ago

Is the i18n package missing? Perhaps it is looking for a missing locale file?

MuluhGodson commented 2 years ago

@brylie Looked more into this issue. It appears our code is correct and works as expected. The localization packages also have no issues. The reason for this error is the version of Vue imported by the CDN link. We currently are using

<script src="https://unpkg.com/vue"></script>

which makes available Vue 3 instead of Vue 2.

Changing this link to

<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>

solved the issue. So this issue is really a none-issue. False flag.

I've updated the link on the staging site. You can now view the new License Chooser on the staging site.

brylie commented 2 years ago

@MuluhGodson, we may need to update our developer documentation in the Chooser package to include the correct example code?

brylie commented 2 years ago

I went ahead and updated the README with a Vue 2 code example.