I am currently working on a project that uses the Vue.js 2.4 + TypeScript + RequireJS stack and I need to upgrade it to the latest version of Vue.js. However, after making the necessary changes according to the documentation, the upgrade breaks the project and I have been unable to resolve the issue.
Here is the code snippet from index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Vue.js Scratchpad</title>
<link rel="icon" type="image/png" href="favicon.png">
<meta charset="UTF-8">
<script src="node_modules/requirejs/require.js"></script>
</head>
<body>
// More code here...
app-pure-vue.ts:
// TypeScript code for app here...
messageComponent-pure-vue.ts:
// TypeScript code for message component here...
In order to upgrade to Vue.js 2.5.0 and the latest vue-router, certain documented changes are required as follows:
package.json
: Update to"vue": "~2.5.0"
+"vue-router": "~3.1.5"
*.ts
: Changeimport * as Vue from "vue";
toimport Vue from "vue";
app-pure-vue.ts
: Change
toimport * as VueRouter from "vue-router";
import VueRouter from "vue-router";
Despite these changes, when upgrading to Vue.js 2.5.0, an error occurs at Vue.extend()
in messageComponent-pure-vue.ts
:
Uncaught TypeError: Cannot read property 'extend' of undefined
at Object.<anonymous> (messageComponent-pure-vue.ts:5)
If you can offer assistance in resolving this issue, please take a look at the minimal reproducible example provided here: https://github.com/DKroot/Scratchpad/tree/master/Client_Side/Vue.js-2.5. The original working 2.4 code can also be found at https://github.com/DKroot/Scratchpad/tree/master/Client_Side/Vue.js-2.4.
Steps taken so far to address the issue:
- Confirmed that the problem arises specifically with the 2.5.0 upgrade
- Carefully reviewed release notes for version 2.5.0 (https://github.com/vuejs/vue/releases/tag/v2.5.0) and related blog posts (https://medium.com/the-vue-point/upcoming-typescript-changes-in-vue-2-5-e9bd7e2ecf08)
- Explored changes in TypeScript declarations for 2.5.0, but struggled to pinpoint the root cause due to complex exports