Skip to content

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

Closed
@sequba

Description

@sequba

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions