Set juiceClient.codeBlocks = cheerio.codeBlocks in /lib/client.js instead of /index.js so that it gets emitted by webpack. I also removed some assignments in /index.js that should already exist because juice = juiceClient.
Motivation
Webpack does not emit juice.codeBlocks = juiceClient.codeBlocks (or any of the other assignments in /index.js). This breaks codeBlocks when using juice in the browser via mjml-browser (see https://github.com/mjmlio/mjml/issues/2653). Assigning codeBlocks in /lib/client.js instead of /index.js fixes the issue when testing locally via npm link.
Hello!
Summary
Set
juiceClient.codeBlocks = cheerio.codeBlocks
in/lib/client.js
instead of/index.js
so that it gets emitted by webpack. I also removed some assignments in/index.js
that should already exist becausejuice = juiceClient
.Motivation
Webpack does not emit
juice.codeBlocks = juiceClient.codeBlocks
(or any of the other assignments in/index.js
). This breakscodeBlocks
when using juice in the browser viamjml-browser
(see https://github.com/mjmlio/mjml/issues/2653). AssigningcodeBlocks
in/lib/client.js
instead of/index.js
fixes the issue when testing locally vianpm link
.Thanks for considering my PR!