minop1205 / react-dnd-treeview

A draggable / droppable React-based treeview component. You can use render props to create each node freely.
MIT License
519 stars 69 forks source link

Rollup bundling process does not handle "~" alias #149

Closed leopuleo closed 1 year ago

leopuleo commented 1 year ago

Describe the bug It looks like Rollup is not handling the ~ substitution with src folder path. This is ok when you inspect the dist folder generated inside the repo...but it fails to build inside a project which uses react-dnd-treeview as dependency.

I hope you can fix this...the library does a great job! :)

To Reproduce Steps to reproduce the behavior:

  1. Add react-dnd-treeview as dependency in a TS project
  2. Navigate to the package folder inside node_modules
  3. Open any file that imports ~/types - i.e. /dist/hooks/useContainerClassName.d.ts(
  4. See screenshots

Expected behavior Transpiled files should contain ../src/ instead of ~

Screenshots Screenshot 2022-09-30 at 16 44 44

Screenshot 2022-09-30 at 16 51 37

minop1205 commented 1 year ago

@leopuleo Thanks for the report!

I understood the problem, but for some reason in my environment I am able to build without any problems.

I would like to reproduce the build error, but it would be helpful if you could tell me your build configuration.

leopuleo commented 1 year ago

Hello @minop1205, thanks for such a quick reply.

To reproduce the error:

  1. Create a new react application (typescript) -> https://create-react-app.dev/docs/adding-typescript/
  2. Add react-dnd-treeview as a dependency and re-create the demo you listed on this repo.
  3. Inside tsconfig.json set skipLibCheck: false (or just delete the line)
  4. Run tsc command.

You should see the errors. Let me know if you need any other help.

minop1205 commented 1 year ago

Merged: https://github.com/minop1205/react-dnd-treeview/pull/151

minop1205 commented 1 year ago

@leopuleo Thanks for the details!

I did some research and found the following link with some helpful information.

https://github.com/ezolenko/rollup-plugin-typescript2/issues/201

The fix is reflected in the package we just released as an alpha version, so please try it.

npm i @minoru/react-dnd-treeview@alpha

I will make an official release of v3.2 with this fix after I address several other Issues.

Thank you very much.

leopuleo commented 1 year ago

Thanks @minop1205, just installed the alpha version and the project compiles!

Thank you for such a quick response.