ngneat / svg-icon

👻 A lightweight library that makes it easier to use SVG icons in your Angular Application
https://netbasal.com
MIT License
260 stars 35 forks source link

Generating icons script throws an issue #81

Closed mayerzx closed 2 years ago

mayerzx commented 2 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

Once I tried to run the generate-icons the following error appears in the terminal:


C:\Users\bened\test\node_modules\@ngneat\svg-generator\tree.js:49
                    svgContent: (0, svgo_1.optimize)(svgContent, { plugins, path: svgPath }).data,
                                                    ^

TypeError: (0 , svgo_1.optimize) is not a function
    at createTree (C:\Users\bened\test\node_modules\@ngneat\svg-generator\tree.js:49:53)
    at generateSVGIcons (C:\Users\bened\test\node_modules\@ngneat\svg-generator\generator.js:19:47)
    at Object. (C:\Users\bened\test\node_modules\@ngneat\svg-generator\index.js:9:34)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

Expected behavior

Generate icon ts files to the expected folder.

Minimal reproduction of the problem with instructions

Generated a new angular application. Run the following command: ng add @ngneat/svg-icon it added the following dependencies to the package.json:


{
  "dependencies": {
    "@ngneat/svg-icon": "^4.1.0",
  },
  "devDependencies": {
    "@ngneat/svg-generator": "^2.0.0"
  }
}

What is the motivation / use case for changing the behaviour?

Once I manually upgraded the svg-generator to version 4.0.0 the problem disappeared. Shouldn't the schematic install the 4.0.0 by default?

Environment


Angular version: 13.3.0


For Tooling issues:
- Node version: v16.14.2  
- Platform:  Windows

Others:
- Npm version: 8.5.5

jchrisjones commented 2 years ago

^^^ Almost carbon copy error on

owuraku commented 2 years ago

Same error :