ghiscoding / slickgrid-react

Slickgrid-React is a wrapper of the lightning fast & customizable SlickGrid datagrid, it also includes multiple Styling Themes
https://ghiscoding.github.io/slickgrid-react/
MIT License
31 stars 9 forks source link

NPM Package excludes source and library features. #233

Closed pbower closed 11 months ago

pbower commented 11 months ago

Describe the bug

.npmignore contains the src package, meaning the package is not runnable following .npm install.

The only 5 files that appear to download with the .npm install are:

global.d.ts LICENSE package.json tsconfig.json README.md

Thanks!

Reproduction

npm install slick-grid-react

Expectation

npm install slick-grid-react install results in being able to import and run the core SlickGrid-React modules in Typescript/React.

Environment Info

Bash Ubuntu 22.04.3 LTS
Typescript
VsCode

Validations

ghiscoding commented 11 months ago

Sorry but I don't really understand your question, why would you want the source files? What do you mean by runnable? All you typically ever need are the distribution files, why would you need the source files? I typically remove all source files from all my other libs. Could you provide mode details and perhaps some code sample because I don't quite understand what the problem is here. Every part of project are TypeScript extendable and that is for both Slickgrid-React and Slickgrid-Universal

Also note that I'm not a React developer, even though this project is under my name, it was actually created by someone else (from my other Slickgrid projects like Angular-Slickgrid), so perhaps it's a React thing that I don't understand. At this point, the other person left and I'm supporting it as much as I can.

pbower commented 11 months ago

That makes sense - my apologies, there were some issues on my end, meaning the dist folder wasn't showing. In the current version, a heads up these modules are not resolvable and cause errors, although I believe this is likely a config resolution with webpack / craco on my end, relating to the parent slickgrid (and/or universal) modules resolving from slickgrid-react. I am including here in case it is worth including any additional setup instructions in https://github.com/ghiscoding/slickgrid-react/wiki/HOWTO--Step-by-Step .

ERROR in ./node_modules/slickgrid-react/dist/esm/components/slickgrid-react.js 8:0-30 Module not found: Error: Can't resolve 'slickgrid/slick.core' in '/node_modules/slickgrid-react/dist/esm/components'

ERROR in ./node_modules/slickgrid-react/dist/esm/components/slickgrid-react.js 9:0-38 Module not found: Error: Can't resolve 'slickgrid/slick.interactions' in '/node_modules/slickgrid-react/dist/esm/components'

ERROR in ./node_modules/slickgrid-react/dist/esm/components/slickgrid-react.js 10:0-30 Module not found: Error: Can't resolve 'slickgrid/slick.grid' in '/node_modules/slickgrid-react/dist/esm/components'

ERROR in ./node_modules/slickgrid-react/dist/esm/components/slickgrid-react.js 11:0-34 Module not found: Error: Can't resolve 'slickgrid/slick.dataview' in '/node_modules/slickgrid-react/dist/esm/components'

As a workaround, I replaced these imports: import 'slickgrid/slick.core'; import 'slickgrid/slick.interactions'; import 'slickgrid/slick.grid'; import 'slickgrid/slick.dataview';

With '../../../../../node_modules/slickgrid/dist/esm/index';

I also tried webpack.config.js and craco.config.js aliasing for Slickgrid, but encountered issues.

Additional details:

This may, or may not be related, however please kindly note there are additionally approx. 396 warnings of this nature: WARNING in ./node_modules/slickgrid-react/dist/esm/services/translater.service.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/node_modules/slickgrid-react/src/slickgrid-react/services/translater.service.ts' file: Error: ENOENT: no such file or directory, open '/node_modules/slickgrid-react/src/slickgrid-react/services/translater.service.ts'

Package.json: "slickgrid": "latest", "slickgrid-react": "latest", "slickgrid-universal": "github:ghiscoding/slickgrid-universal",

Assuming this is config-related please feel free to close this, however if there are any recommended setup steps here for the 'How to guide' would be greatly appreciated.

Regards, Peter

ghiscoding commented 11 months ago

This is unlikely a problem with the library itself since the demo works properly, I always check that it works before & after publishing a new release. I don't need to modify any of the imports, it's likely a problem in your configuration, you should really compare against the Slick-React-Demos, it is using WebPack and it works without any problem.

Package.json: "slickgrid": "latest", "slickgrid-react": "latest", "slickgrid-universal": "github:ghiscoding/slickgrid-universal",

Well this is likely 1 of the major problem you have, the latest version of SlickGrid (5.0) is not compatible with my other libs and I'm not sure why you're overriding it to use the latest since I know it will fail (the dist files are not located at the same place and the build is totally different). You should never override the SlickGrid core library, you're looking for trouble when doing that. So don't do that because it will fail. I am working on that next version as a major and breaking change and that is likely a couple months away (for example this Slickgrid-Universal PR is towards that goal but there is still a lot of work to do for the next major).

So in summary, I strongly advise you to look at the Slick-React-Demos and if the HOWTO is missing something, it could be updated, it was done a while ago so some instructions might be out of sync or incorrect.