You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Import Consts should be resolved by webpack and should function as any other import would. Instead, webpack doesn't change this import to the usual WEBPACK_IMPORTED_MODULE stuff - it stays as Consts, which is undefined in the compiled javascript.
Note that this issue also happens if the import of Consts is changed to import { Foo } from './imported-const' and the corresponding usage is changed accordingly.
What is actually happening?
vue.runtime.esm.js?2b0e:587 [Vue warn]: Error in mounted hook: "ReferenceError: Consts is not defined"
found in
---> <App> at src\App.vue
<Root>
warn @ vue.runtime.esm.js?2b0e:587
vue.runtime.esm.js?2b0e:1737 ReferenceError: Consts is not defined
at new DerivedFoo (App.vue?95a9:16)
at VueComponent.mounted (App.vue?95a9:25)
at callHook (vue.runtime.esm.js?2b0e:2917)
at Object.insert (vue.runtime.esm.js?2b0e:4154)
at invokeInsertHook (vue.runtime.esm.js?2b0e:5956)
at Vue.patch [as __patch__] (vue.runtime.esm.js?2b0e:6175)
at Vue._update (vue.runtime.esm.js?2b0e:2656)
at Vue.updateComponent (vue.runtime.esm.js?2b0e:2784)
at Watcher.get (vue.runtime.esm.js?2b0e:3138)
at new Watcher (vue.runtime.esm.js?2b0e:3127)
at mountComponent (vue.runtime.esm.js?2b0e:2791)
at Vue.$mount (vue.runtime.esm.js?2b0e:7995)
at eval (main.ts?cd49:8)
at Module../src/main.ts (app.js:1387)
at __webpack_require__ (app.js:717)
at fn (app.js:99)
at Object.0 (app.js:1400)
at __webpack_require__ (app.js:717)
at app.js:784
at app.js:787
If I pull the code in question out of a .vue file and into a plain .ts file and then compile it on its own with tsc, the compiled output is identical between 2.8.3 and 2.9.1. This seems to indicate that it isn't a bug specifically with Typescript, but somewhere in the toolchain's interactions with Typescript.
The text was updated successfully, but these errors were encountered:
Currently I'm having an issue where I've imported a variable, and the import is being removed during transpilation. The reference still remains, but the code breaks at runtime because the import is missing.
[...]
the issue is currently occurring when an imported reference is used only in super clause of a constructor.
That looks like exactly the issue. Thanks for taking a look! I'll let you close this one out as you see fit; not sure if you wanted to leave it open to track the bump to 2.9.2 when it comes out.
Version
3.0.0-beta.15
Reproduction link
https://github.com/ascott18/vue-cli-ts291-bug
Steps to reproduce
yarn
yarn serve
What is expected?
Import
Consts
should be resolved by webpack and should function as any other import would. Instead, webpack doesn't change this import to the usualWEBPACK_IMPORTED_MODULE
stuff - it stays asConsts
, which is undefined in the compiled javascript.Note that this issue also happens if the import of
Consts
is changed toimport { Foo } from './imported-const'
and the corresponding usage is changed accordingly.What is actually happening?
Typescript 2.9.1 suffers from this; downgrading to 2.8.3 fixes this error. See https://github.com/ascott18/vue-cli-ts291-bug/tree/ts-283.
If I pull the code in question out of a .vue file and into a plain .ts file and then compile it on its own with
tsc
, the compiled output is identical between 2.8.3 and 2.9.1. This seems to indicate that it isn't a bug specifically with Typescript, but somewhere in the toolchain's interactions with Typescript.The text was updated successfully, but these errors were encountered: