Morphdom is not a function
isabellachen opened this issue · comments
When I try to run a function that calls yo.update
I get an uncaught TypeError, morphdom is not a function
I have the latest version of yo-yo: 1.4.1
When changed the code in yo-yo's index.js
file (ln 14) from morphdom(fromNode, toNode, opts)
to morphdom.default(fromNode, toNode, opts)
and it works for me now. But this is obviously not the way to do it. I checked and I also have the lastest version of morphdom morphdom@2.5.6
installed in my node_modules.
@isabellachen Sounds like you might need to downgrade to an older version of morphdom since they broke something... maybe try version 2.1.0
. Or if you need the latest version then your hack would work okay I think
@isabellachen , did you fix your problem? I think I had the same one, which stemmed from some unplanned upgrades in my webpack/babel stack. As best I can tell, there's some disagreement around backwards compatibility/slop of default exports in webpack.
To get yo-yo working after my upgrades, I added to my package.json the dependency @babel/runtime ^7.8.3 and devDependencies
- @babel/plugin-transform-runtime ^7.8.3
- babel-loader ^8.0.6
- babel-plugin-add-module-exports ^1.0.2
- babel-polyfill ^6.26.0
I also prefixed my webpack config entry value with ['babel-polyfill', ....
and installed babel-loader in my webpack.config.js rules
{
test: /\.js$/,
loader: 'babel-loader',
query: {
presets: [['@babel/env', { modules: 'commonjs' }]],
plugins: ['add-module-exports']
}
}
@jonathanlb Thanks for the solution. We actually copied the entire library into our own files an used it this way for awhile before running into other troubles and giving in to using React :/