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

Usage in a Node/Expressapplication #182

Open
lsliwaradioluz opened this issue Jan 9, 2025 · 0 comments
Open

Usage in a Node/Expressapplication #182

lsliwaradioluz opened this issue Jan 9, 2025 · 0 comments

Comments

@lsliwaradioluz
Copy link

I am trying to use @storyblok/richtext in my NodeJS/Express application. Previously I was using storybloj-js-client/richtext but it is now deprecated. However, when running my compiled Node application with the node command, I am getting the following error:

require() of ES Module @storyblok/richtext/dist/storyblok-richtext.umd.js from @vsf-enterprise/storyblok-api/server/index.js
not supported. storyblok-richtext.umd.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains \"type\": \"module\" which declares all .js files in that package scope as ES modules.

Expected Behavior

Library works in a Node.js application which uses CommonJS

Current Behavior

Judging by the presence of the exports.require field in your library's package.json, I assume your intention was to support both browser and Node environments. However, to make it work in our Node application, I had to make the following changes to your library's package.json and symlink it in my project:

image

I can see there has already been a similar issue raised but it was closed immediately by the author. That makes me wonder if there is any other solution to the problem and reason behind using umd.js in the exports.require.

Steps to Reproduce

Please, let me know if you need those - I can prepare a sample Node app which reproduces the behaviour.

@lsliwaradioluz lsliwaradioluz changed the title Usage in a Node.js application Usage in a Node application Jan 9, 2025
@lsliwaradioluz lsliwaradioluz changed the title Usage in a Node application Usage in a Node/Expressapplication Jan 9, 2025
@lsliwaradioluz lsliwaradioluz reopened this Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant