question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Library crash on startup in AMD project

See original GitHub issue

Hi, I have an AMD project (requirejs) with Vue.js 2.5…once that the umd file is loaded i see the foolowing error message:

vue-grid-layout.js?v=1.0.0.0:6756 Uncaught TypeError: Cannot read property 'component' of undefined
    at vue-grid-layout.js?v=1.0.0.0:6756
    at Array.forEach (<anonymous>)
    at Module.fb15 (vue-grid-layout.js?v=1.0.0.0:6755)
    at __webpack_require__ (vue-grid-layout.js?v=1.0.0.0:30)
    at vue-grid-layout.js?v=1.0.0.0:94
    at vue-grid-layout.js?v=1.0.0.0:97
    at Object.execCb (require.js:1696)
    at Module.check (require.js:883)
    at Module.enable (require.js:1176)
    at Module.init (require.js:788)

…seems that there is something wrong on load, requiring webpack anyway.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Micene09commented, Dec 21, 2018

I think i got it, setting the external dependency in that way (externals object), leaded to one of the deepest errors: the module name is not the same, it will change with the module system.

In your case, the module name for the root (global variable) is not vue, but Vue. For this reason, setting the externals object in that way is wrong.

But, i found the real solution to this (and future problems like this), just following the doc ->externals->object. As you can read, we can set a module name for each module system, so the right way to do this should be:

externals : {
    vue : {
      commonjs: 'vue', // the default commonjs module name
      amd: 'vue',  // required to make it work for AMD
      root: 'Vue' // the default global variable
    }
}
// maybe you can try to NOT override the commonjs and root values
// ...just because that are the default values:
externals : {
    vue : {
      amd: 'vue'
    }
}

Please, before revert and release, try this solution.

0reactions
reidcjkcommented, May 24, 2019

I think i got it, setting the external dependency in that way (externals object), leaded to one of the deepest errors: the module name is not the same, it will change with the module system.

In your case, the module name for the root (global variable) is not vue, but Vue. For this reason, setting the externals object in that way is wrong.

But, i found the real solution to this (and future problems like this), just following the doc ->externals->object. As you can read, we can set a module name for each module system, so the right way to do this should be:

externals : {
    vue : {
      commonjs: 'vue', // the default commonjs module name
      amd: 'vue',  // required to make it work for AMD
      root: 'Vue' // the default global variable
    }
}
// maybe you can try to NOT override the commonjs and root values
// ...just because that are the default values:
externals : {
    vue : {
      amd: 'vue'
    }
}

Please, before revert and release, try this solution.

Awesome! Quite helpful!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Steam Games Crashing on Startup - [Tutorial]
How to Fix Steam Games Crashing on Startup TutorialThis issue could be due to a corrupted or antiquated graphics card driver.
Read more >
Vulkan: Godot crashes on startup with AMD graphics driver on ...
With debug Godot seems to run fine. Ran a very basic project and it seemed to work without any issues. Commit e253451. With...
Read more >
Dedicated x64 server crash on startup :: Project Zomboid Bug ...
Dedicated x64 server crash on startup. I have home server. AMD Ryzen 3 PRO 4350G 16G RAM Game version 41.65 this is error...
Read more >
SOLIDWORKS Visualize Crashes While Initializing or ...
If SOLIDWORKS Visualize crashes when opening new or existing projects or hangs while initializing at startup, this guide can help resolve ...
Read more >
Fix Illustrator crash issues - Adobe Support
Unable to open Illustrator? Illustrator crashing or freezing? We're here to help!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found