PolymerElements/marked-element

Webpack support broken

Closed this issue · 4 comments

Issue with webpack using @polymer/iron-demo-helpers/demo-snippet on version 3.0.0-pre.23:

Uncaught ReferenceError: marked is not defined
    at HTMLElement.render (marked-element.js:298)

I think this has been fixed in #81 and then broke again.

&& window.require has been added here 1fef15d#diff-b3e973a07f826cf78314752a8b5a4cfcR13
If I revert that line to if (!window.marked) {, it fixes the bug, but I don't understand why && window.require has been added.

Yup I'm seeing this problem too.

Webpack doesn't introduce a window.require, it replaces require calls with a __webpack_require__ on build.

So we should probably if (!window.marked && require) {

cc @e111077

It was added for Polymer 3 support in which modules run in strict mode and this will cause an exception otherwise. I suppose the change can be reverted for 2.x to support we pack, but this is a no-go for us modules.

We are currently in a code freeze so this reversion may have to wait

misread. this is in the 3.x branch. Did some local testing. It seems to work just fine without the check. Will make a PR to revert

I confirm it's fixed, thanks