ux icon indicating copy to clipboard operation
ux copied to clipboard

Not imports ux-icons

Open DanieleRosada opened this issue 4 years ago • 2 comments

import * as icons from '@aurelia-ux/icons/sets/full-array.min.json'; aurelia.use.plugin(PLATFORM.moduleName('@aurelia-ux/icons'), { icons })

This is my main.ts. I ran the instructions found in https://aurelia.io/blog/2020/03/02/aurelia-release-notes-march-2020/

Could anyone help me? Do I need to import anything into webpack?

DanieleRosada avatar Apr 23 '20 19:04 DanieleRosada

Hi @DanieleRosada thanks for reaching here.

What you did is right. Are you using typescript ? Did you also follow the instruction regarding the tsconfig.json on the blog ?

Basically it says:

Importing JSON

Note for TypeScript users: Make sure that your tsconfig.json is set to allow importing JSON files. This can be achieved by setting "resolveJsonModule": true in the compilerOptions section.

If this doesn't solve your problem, could you give us more details regarding your situation ?

  • are you using typescript ?
  • any error or warning in the console ?

Alternative solution:

I have faced a situation once where even with the resolveJsonModule: true in tsconfig.json the icons would not load properly. I realized that even though the module would import, it would not be imported as expected. To fix this I did this in the main.ts:

.plugin(PLATFORM.moduleName('@aurelia-ux/icons'), {icons: (icons as any).default})

If this is also your case please let me know as I would like to investigate a little more and see if we can find a better solution.

ben-girardet avatar Apr 24 '20 05:04 ben-girardet

.plugin(PLATFORM.moduleName('@aurelia-ux/icons'), {icons: (icons as any).default})

With this it works, thank you! I use typescript and I had no errors and no warnings,
except this warning that's left in the visual studio code console:

WARNING in @aurelia-ux/core Multiple versions of @aurelia-ux/core found: 0.18.1 ./~/@aurelia-ux\core 0.19.0 ./~/@aurelia-ux\icons/~/@aurelia-ux\core

DanieleRosada avatar Apr 24 '20 19:04 DanieleRosada