komodojp / tinyld

Simple and Performant Language detection library for NodeJS

Home Page:https://komodojp.github.io/tinyld/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESM broken since version 1.2.1

diegone opened this issue · comments

CJS require works but ESM import throws an exception from version 1.2.1 to 1.2.3. Version 1.2.0 works fine.

Can you explain more about the error you get and how you are using it?

I just tested the last version with a simple HTML code and <script type="module"> and it work without any trouble with the ESM file.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
  </head>
  <body>
    <script type="module">
      import { detect } from './dist/tinyld.esm.js'

      console.log(detect('test my text'))
    </script>
  </body>
</html>

Sorry, I should have been more specific. This happened to me using Node.js 16.13.1. If I do import('tinyld') from the REPL or import tinild from 'tinild' from my module, I get a dump of the source and a SyntaxError: Unexpected token 'export' exception. The same works fine with 1.2.0.

This should be solved in last version 👍