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

Unable to export packages that use solid-icons using rollup #50

Closed
linkthai opened this issue Sep 5, 2023 · 3 comments
Closed

Unable to export packages that use solid-icons using rollup #50

linkthai opened this issue Sep 5, 2023 · 3 comments

Comments

@linkthai
Copy link
Contributor

linkthai commented Sep 5, 2023

I'm trying to build a core library, which will get imported and used by multiple projects. I has an icon modules where it imports certain icons from solid-icons. The problem happens when I use rollup to bundle the library, all icons from solid-icons cause this error.

[!] RollupError: "RiDesignEdit2Line" is not exported by "node_modules/.pnpm/solid-icons@1.0.9_solid-js@1.7.6/node_modules/solid-icons/ri/index.cjs", imported by "src/components/base/icons/icons-remix.tsx".
https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module

Here are the rollup.config.ts

import ignoreImport from "rollup-plugin-ignore-import";
import withSolid from "rollup-preset-solid";

const plugins = [
  ignoreImport({
    // Ignore all .scss and .css file imports while building the bundle
    extensions: [".scss", ".css"],
    // Optional: replace body for ignored files. Default value is "export default undefined;"
    body: "export default undefined;",
  }),
];

export default withSolid([
  {
    input: "src/index.ts",
    targets: ["esm"],
    mappingName: "index",
    output: {
      file: "./dist/lib/index.js",
      format: "module",
      inlineDynamicImports: true,
    },
    plugins,
  },
  {
    input: "src/index.ts",
    mappingName: "index",
    solidOptions: {
      generate: "ssr",
      hydratable: false,
    },
    targets: ["cjs"],
    output: {
      file: "./dist/lib/index.cjs",
      format: "cjs",
    },
    plugins,
  },
]);
@x64Bits
Copy link
Owner

x64Bits commented Sep 19, 2023

Hi @linkthai, thanks for reporting this, I'm almost sure this is due to the exports key in package.json, I've compared it with the export of the solid-js modules and it seems to have adopted the modern way depending on the runtime, this package (solid-icons) should also migrate that way.

This change would be included in 1.1.0 which is still in progress I hope it helps with this problem.

@x64Bits x64Bits mentioned this issue Sep 20, 2023
@x64Bits
Copy link
Owner

x64Bits commented Nov 1, 2023

Hi @linkthai, version 1.1.0 has been released, could you check if this version corrects your problem? I was able to check and now it works to build in astro, greetings and thank you very much!

@x64Bits x64Bits closed this as completed Nov 6, 2023
@linkthai
Copy link
Contributor Author

linkthai commented Nov 9, 2023

Hello @x64Bits, I missed your question last time sorry for the late answer. I tried exporting with rollup and it worked absolutely fine now, thank you for the help.

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

2 participants