Skip to content

Error when registering custom component #28

@WineTrust-project

Description

@WineTrust-project

Hi,

I'm new to mjml custom components, and i have an issue trying to install the boilerplate components.
I've cloned and installed successfully the project.

But when I try to run npm start, I get the following errors :
Missing or unreadable custom component : ./lib/MjBasicComponent.js
Missing or unreadable custom component : ./lib/MjImageText.js
Missing or unreadable custom component : ./lib/MjLayout.js

I've then update my .mjmlconfig file since the compiled components files are created inside /lib/component/ not /lib/ directly:

{
  "packages": [
    "./lib/components/MjBasicComponent.js",
    "./lib/components/MjImageText.js",
    "./lib/components/MjLayout.js"
  ]
}

Now when i run npm start again, I get the following errors:
Error when registering custom component : C:[...]\lib\components\MjBasicComponent.js TypeError: Cannot read property 'BodyComponent' of undefined

  • same error for the 2 other native components

[18:27:50] Using gulpfile ~[...]\gulpfile.babel.js
[18:27:50] Starting 'watch'...
[18:27:51] 'watch' errored after 179 ms
[18:27:51] Error: Cannot find module 'C:[...]\lib\MjBasicComponent.js'
Require stack:

  • C:[...]\gulpfile.babel.js
  • C:[...]\node_modules\gulp\node_modules\gulp-cli\lib\versioned^4.0.0\index.js
  • C:[...]\node_modules\gulp\node_modules\gulp-cli\index.js
  • C:[...]\node_modules\gulp\bin\gulp.js

What looks strange is that the error says it can't find module that should be located in the /lib/component/ folder, not /lib/ directly.

Many thanks in advance for your help.

Cheers,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions