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

Error after upgrading to the latest version #3354

Open
pacoorozco opened this issue Jun 27, 2024 · 1 comment
Open

Error after upgrading to the latest version #3354

pacoorozco opened this issue Jun 27, 2024 · 1 comment
Labels

Comments

@pacoorozco
Copy link

Marked version:
13.0.1 (the previous version was 0.7.0)

Describe the bug
After upgrading the dependency from v0.7.0 to v13.0.1 and building my app I get this error:

[ ERROR ]  Rollup: Plugin Error: node_modules/marked/lib/marked.umd.js:253:15
           Unexpected token (253:15) in
           /home/public/src/Adevinta/Privacy-Broker/privacy-console/node_modules/marked/lib/marked.umd.js
           (plugin: commonjs, transform)

    L252:  class _Tokenizer {
    L253:      options;
    L254:      rules; // set by the lexer

[ ERROR ]  ENOENT: no such file or directory, open
           '/home/public/src/Adevinta/Privacy-Broker/privacy-console/www/build/app.esm.js'

To Reproduce
Steps to reproduce the behavior:

  1. Stencil.js framework, using Typescript 5.5.2
  2. Upgrade marked to 13.0.1
  3. Run npm run build

Expected behavior
It should build without any problem

This is the code:

import { Component, Element, Prop, h } from '@stencil/core';
import { marked } from 'marked';
import DOMPurify from 'dompurify';

@Component({
  tag: 'marked-down',
})
export class MarkedDown {
  @Prop() content: string;
  @Element() element: HTMLElement;

  render() {
    const html = marked.parse(this.content) as string;
    this.element.innerHTML = DOMPurify.sanitize(html);
    return <div></div>;
  }
}
@UziTech
Copy link
Member

UziTech commented Jun 27, 2024

Looks like you are trying to compile to a version of JavaScript that does not have class properties.

You will have to transpile marked with something like babel. Or compile your code to a more modern version of ecmascript.

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

2 participants