最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Angular 18 Karma problem using loader svg in angular.json - Stack Overflow

programmeradmin3浏览0评论

I and currently using Angular 18, and I couldn't upgrade to 19 yet. I tried to import .svg file in my .ts file and it work fine.

This is how my angular.json look like

          "builder": "@ngx-env/builder:application",
          "options": {
            "outputPath": "dist/jv-b2b-frontend",
            "index": "src/index.html",
            "browser": "src/main.ts",
            "polyfills": ["zone.js"],
            "tsConfig": "tsconfig.app.json",
            "assets": ["src/favicon.ico", "src/assets", "src/assets/*"],
            "styles": ["src/styles.css"],
            "scripts": [],
            "sourceMap": true,
            "loader": {
              ".svg": "text"
            }
          }

When I tried to ng test, I got the following error

Error: Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.
发布评论

评论列表(0)

  1. 暂无评论