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

bug(turndown): no browser support #9884

Closed
maxpatiiuk opened this issue Feb 8, 2024 · 4 comments
Closed

bug(turndown): no browser support #9884

maxpatiiuk opened this issue Feb 8, 2024 · 4 comments
Labels
bug It's a bug stale An issue that hasn't been active for a while...

Comments

@maxpatiiuk
Copy link
Contributor

maxpatiiuk commented Feb 8, 2024

Current behaviour

While original turndown includes builds for the browser, @joplin/turndown only includes a single build:

Screenshot 2024-02-07 at 20 16 04

Screenshot 2024-02-07 at 20 16 15

And unlike the original turndown, @joplin/turndown has const css = require('css'); import, which in turn imports fs:

https://github.com/reworkcss/css/blob/master/lib/stringify/source-map-support.js#L9

That causes an error in Webpack when trying to build a project that uses @joplin/turndown:

ERROR in ./node_modules/@joplin/turndown/node_modules/css/lib/stringify/source-map-support.js 9:9-22
Module not found: Error: Can't resolve 'fs' in '/Users/maxpatiiuk/site/javascript/text-hoarder/node_modules/@joplin/turndown/node_modules/css/lib/stringify'

The same goes for "path" and "url" node core modules

Expected behaviour

Could you please publish the browser builds like the original library did?


A workaround for now involves adding this to my webpack config:

    resolve: {
      fallback: {
        fs: false,
        path: false,
      },
    }

and things seem to work fine, but doesn't meant it will keep working in the future...

Thanks

@maxpatiiuk maxpatiiuk added the bug It's a bug label Feb 8, 2024
@personalizedrefrigerator
Copy link
Collaborator

Looking at the code tab on NPM, it seems that the published version of @joplin/turndown uses css and not @adobe/css-tools:

'use strict';

const css = require('css');

function extend (destination) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i];
    for (var key in source) {

This difference is likely related to Joplin's release cycle.

@adobe/css-tools is a fork of the css package that should have browser support. See this commit and this pull request for additional details.

maxpatiiuk added a commit to maxpatiiuk/text-hoarder that referenced this issue Feb 8, 2024
Workaround for mixmark-io/turndown-plugin-gfm#3
and other issues too ... by migrating to a more well-maintained fork of
Turndown.

Though the fork also has it's own issues. Applying workarounds for:
Workaround for laurent22/joplin#9885
Workaround for laurent22/joplin#9884
Workaround for laurent22/joplin#9881
@maxpatiiuk
Copy link
Contributor Author

That's great news - looking forward to the new release!

Copy link
Contributor

github-actions bot commented Mar 9, 2024

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

@github-actions github-actions bot added the stale An issue that hasn't been active for a while... label Mar 9, 2024
Copy link
Contributor

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, feel free to create a new issue with up-to-date information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug stale An issue that hasn't been active for a while...
Projects
None yet
Development

No branches or pull requests

2 participants