Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Language files do not work with ES modules in node #1344

Open
sequba opened this issue Nov 28, 2023 Discussed in #1340 · 1 comment · Fixed by #1377
Open

Language files do not work with ES modules in node #1344

sequba opened this issue Nov 28, 2023 Discussed in #1340 · 1 comment · Fixed by #1377
Assignees
Labels
Breaking Change Will need a major release Bug Something isn't working Impact: High

Comments

@sequba
Copy link
Contributor

sequba commented Nov 28, 2023

Description

Importing language files:

  • seems to work in UMD module system
  • seems to work in CommonJS although we should verify if the setup is optimal
  • does not work in ESM in node
  • does not work in ESM in React

Demo

https://codesandbox.io/p/devbox/test-hyperformula-with-nodejs-pgkwd8

Error messages

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/workspaces/sandbox/node_modules/hyperformula/es/i18n/languages/frFR' imported from /workspaces/sandbox/index.js
Did you mean to import hyperformula/es/i18n/languages/frFR.js?
(node:328) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/workspaces/sandbox/node_modules/hyperformula/es/i18n/languages/frFR.js:417
export default dictionary;
^^^^^^

SyntaxError: Unexpected token 'export'

Notes

Related issues

@sequba sequba added Bug Something isn't working Breaking Change Will need a major release Impact: High labels Nov 28, 2023
@sequba sequba self-assigned this Nov 28, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Breaking Change Will need a major release Bug Something isn't working Impact: High
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant