Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Morphdom is not a function #75

Open
isabellachen opened this issue Aug 7, 2019 · 4 comments · May be fixed by #77
Open

Morphdom is not a function #75

isabellachen opened this issue Aug 7, 2019 · 4 comments · May be fixed by #77

Comments

@isabellachen
Copy link

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

@isabellachen
Copy link
Author

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.

@max-mapper
Copy link
Owner

@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

@jonathanlb
Copy link

@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']
       }
   }

@isabellachen
Copy link
Author

@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 :/

davidguttman added a commit to davidguttman/yo-yo that referenced this issue Dec 26, 2020
The actual morphdom function isn't available because of modules/bundlers. See max-mapper#75 (comment) for more information.

Closes max-mapper#75
@davidguttman davidguttman linked a pull request Dec 26, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants