iter-tools / iter-tools

The iterable toolbox
MIT License
170 stars 24 forks source link

Are there mixed up during the `mjs` build? #507

Open midnight-wonderer opened 3 hours ago

midnight-wonderer commented 3 hours ago

Rollup complained about the package.

[!] RollupError: node_modules/iter-tools/index.mjs (282:9): "default" is not exported by "node_modules/iter-tools/methods/take.js", imported by "node_modules/iter-tools/index.mjs".

The problem is index.mjs does not export from .mjs version of functions but .js.

Quick check

Maybe I misunderstood something, or maybe there is something wrong with the build process. Could you clarify?

midnight-wonderer commented 2 hours ago

It actually works after setting up the commonjs plugin.

import { default as commonjs } from '@rollup/plugin-commonjs';

export default {
  ...rollupOptions,
  plugins: [
    ...otherPlugins,
    commonjs({
      include: [
        'node_modules/iter-tools*/**/*.js',
      ],
    }),
  ],
};

I will leave the issue open in case this is unintended.
Feel free to close it if this is expected and the proper way to build the module.