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

[Docs] I want to help improve the docs with some examples I solved recently #1729

Open
AllanPinheiroDeLima opened this issue Dec 24, 2024 · 0 comments

Comments

@AllanPinheiroDeLima
Copy link

AllanPinheiroDeLima commented Dec 24, 2024

What feature or change would you like to see made?

This week I had a build problem regarding some tools in the stack. First things first, I am using VueJS, Vuetify, Vite and developing on a Mac aiming to give support for viewers in browsers and mobile too. I don't know if the same happens on Window, but I have a good guess that it happens on Ubuntu, since my deploy gave the same error.

The problem:
The library @icr/polyseg-wasm was added because I am adding 3D and segmentation. While it's mentioned in the official docs ( I'm meaning those https://www.cornerstonejs.org/docs ) and this bug was mentioned elsewhere, it took me a long while until I found out the solution. I think that this should be in the installation docs section.

This was the solution:

build: {
    rollupOptions: {
      external: ["@icr/polyseg-wasm"],
    }
  },

The second one I have had with @cornerstonejs/core. I was having this error below:
No known conditions for "./types" specifier in "@cornerstonejs/core" package

This one is because of the path mapping on vite. In development, it works normally, but when you try to build, it throws this error and stops everything. I really don't know why it happened, Once again, it took me a while to find the solution and it was to add an alias on Vite options, like this:

resolve: {
  alias: {
    '@': fileURLToPath(new URL('./src', import.meta.url)),
    '@root': fileURLToPath(new URL('./', import.meta.url)),
    "@cornerstonejs/core": fileURLToPath(new URL('node_modules/@cornerstonejs/core/dist/esm', import.meta.url)),
  },
},

The last one happened to me while using the types from @cornerstonejs/tools. Seems that the enums/types inside the lib are being minified for some reason and inlined in code when used outside it. Causing the tools to be registered with minified names in the lib folder, but with their normal names at the app level. Like, my LengthTool registered was named "FE", but when I tried to activate it, it was called Length correctly. Again, I don't know why it happens and I didn't have time to investigating because of the Christmas and all. My solution was to prevent minification at all.

 build: {
  minify: false, 
  }

Why should we prioritize this feature?

I think that most people will create apps using svelte/sveltekit, react/next, angular may have those problems and they can take a long time to discover and fix. I think this addition in the docs could empower the dev to look only to the app, instead of the build process.

I don't know if this has something to do with the vuetify configuration or anything else, but I'll gladly give my vite configuration to help you look into it.

Although I want to help with those issues I have presented, I want to document those in the docs. I wanted guidance about how to do this and open a pull request.

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

1 participant