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

mjml-core miss babel-runtime dep #1016

Closed
natesilva opened this issue Mar 2, 2018 · 9 comments
Closed

mjml-core miss babel-runtime dep #1016

natesilva opened this issue Mar 2, 2018 · 9 comments
Labels
Milestone

Comments

@natesilva
Copy link

The mjml-core module doesn’t work as a standalone module. It errors on import.

Use case: The main mjml module brings in a ton of dependencies that we don’t want (including mjml-cli which brings in the somewhat problematic fsevents via chokidar). We just need the mjml2html() function so I hoped to get that from mjml-core.

Reproduction Steps:

$ npm i mjml-core
   [ …usual install output… ]
$ node
> var mjmlCore = require('mjml-core');
Error: Cannot find module 'babel-runtime/helpers/toConsumableArray'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)

MJML version:

4.0.0
Node: 8.9.4
NPM: 5.6.0

@natesilva natesilva changed the title mjml-core cannot be imported mjml-core cannot be imported Mar 2, 2018
@iRyusa
Copy link
Member

iRyusa commented Mar 6, 2018

Hi @natesilva

Thanks for reporting this, looks like babel-runtime is missing on a lot of packages ! Nice catch 👍

You can "bypass" temporarily it by adding the babel-runtime to your project

@iRyusa iRyusa added the MJML 4 label Mar 6, 2018
@iRyusa iRyusa changed the title mjml-core cannot be imported mjml-core miss babel-runtime dep Mar 6, 2018
@matass
Copy link

matass commented Mar 12, 2018

hi @iRyusa

I have added babel-runtime (6.26.0), now I'm getting this error:

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: Error in file /xxx/xxx.mjml: Cannot read property 'mj-container' of undefined

@iRyusa
Copy link
Member

iRyusa commented Mar 12, 2018

Really weird error considering that mj-container doesn't exist anymore, can you try to reinstall or provide the template to reproduce?

@matass
Copy link

matass commented Mar 12, 2018

I'm using mjml-core in my own package (https://github.com/matass/swu-mjml). so I'll try to make fresh mjml app and compile some templates

@iRyusa
Copy link
Member

iRyusa commented Mar 12, 2018

Looks like a dep issue in your project, you're using mjml-core 4.0 + gulp-mjml (MJML3.0 dep).

Note that gulp-mjml isn't up to date with MJML4

@matass
Copy link

matass commented Mar 12, 2018

Ok, thanks. I think I have to rollback to previous mjml-core version. Do You have any plans to make mjml-4 compatible with gulp-mjml?

@iRyusa
Copy link
Member

iRyusa commented Mar 12, 2018

Here mjmlio/gulp-mjml#34 but we're focusing on MJML4 fixes before.

@ngarnier ngarnier added this to the 4.2.0 milestone Apr 25, 2018
kmcb777 added a commit that referenced this issue Aug 9, 2018
fix #1016 add babel-runtime dep on packages that could be imported
@kmcb777
Copy link
Collaborator

kmcb777 commented Sep 13, 2018

Hi @natesilva this has been fixed in the new release mjml4.2-beta, which you can install with npm install mjml, you can check if it solves the problem

@natesilva
Copy link
Author

Thank you. It works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants