【问题标题】:nativescript - You may need an appropriate loader to handle this file type, currently no loaders are configured to process this filenativescript - 您可能需要适当的加载程序来处理此文件类型,目前没有配置加载程序来处理此文件
【发布时间】:2021-07-18 09:40:45
【问题描述】:

当我执行 tns prepare ios 时,我不断收到此错误。 我觉得它以前可以工作,但在某些时候,它停止工作并抛出该错误消息。 似乎它正在寻找加载器,但我不确定如何配置它。 有什么想法吗?

这是我的 webpack.config.js


module.exports = (env) => {
    webpack.init(env);

    // Learn how to customize:
    // https://docs.nativescript.org/webpack

    return webpack.resolveConfig();
};


这是我的 pakage.json

  "name": "@nativescript/template-hello-world-ng",
  "main": "src/main.ts",
  "version": "8.0.5",
  "author": "NativeScript Team <oss@nativescript.org>",
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "publishConfig": {
    "access": "public"
  },
  "files": [
    "App_Resources",
    "hooks",
    "src",
    "tools",
    "!tools/assets",
    ".editorconfig",
    "references.d.ts",
    "tsconfig.json"
  ],
  "keywords": [
    "nativescript",
    "mobile",
    "angular",
    "{N}",
    "template"
  ],
  "repository": "<fill-your-repository-here>",
  "bugs": {
    "url": "https://github.com/NativeScript/NativeScript/issues"
  },
  "dependencies": {
    "@angular/animations": "^11.2.11",
    "@angular/common": "^11.2.11",
    "@angular/compiler": "^11.2.11",
    "@angular/core": "^11.2.11",
    "@angular/forms": "^11.2.11",
    "@angular/platform-browser": "^11.2.11",
    "@angular/platform-browser-dynamic": "^11.2.11",
    "@angular/router": "^11.2.11",
    "@nativescript/angular": "~11.8.0",
    "@nativescript/core": "^8.0.2",
    "@nativescript/theme": "~3.0.1",
    "@nstudio/nativescript-snackbar": "^2.1.0",
    "nativescript-clipboard": "^2.1.1",
    "reflect-metadata": "~0.1.13",
    "rxjs": "~6.6.7",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^11.2.11",
    "@nativescript/ios": "8.0.0",
    "@nativescript/types": "^8.0.1",
    "@nativescript/webpack": "beta",
    "@ngtools/webpack": "^11.2.10",
    "typescript": "~4.0.0"
  },
  "private": "true",
  "readme": "NativeScript Application",
  "scripts": {
    "ip11": "tns run ios --device 'iPhone 11'"
  }
}

这是我的 tsconfig.json

  "compilerOptions": {
    "module": "esnext",
    "target": "es2017",
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "noEmitHelpers": true,
    "noEmitOnError": true,
    "skipLibCheck": true,
    "lib": ["es2017", "dom"],
    "baseUrl": ".",
    "paths": {
      "~/*": ["src/*"],
      "@/*": ["src/*"]
    }
  },
  "include": ["src/tests/**/*.ts", "src/**/*.ios.ts", "src/**/*.android.ts"],
  "files": ["./src/main.ts", "./references.d.ts"],
  "exclude": ["node_modules", "platforms", "e2e"]
}

【问题讨论】:

    标签: typescript webpack nativescript loader


    【解决方案1】:

    这与 webpack 无关。 由于某些原因,我的 @nativescript/core 已被删除。 所以,我只需要npm i @nativescript/core

    【讨论】:

    • 我遇到了同样的错误,将我的应用程序从 6.5 迁移到 8.0.2。你做了什么别的吗,因为这里没有删除 @nativescript/core 包。看起来也不像您缺少它,因为它找到了 ./node_modules/@nativescript/core/ui/core/view-base/index.js 文件
    【解决方案2】:

    刚刚为此发布了一个拉取请求和补丁更新: @nativescript/core 8.0.3

    请看这里: https://github.com/NativeScript/NativeScript/pull/9354

    请确保您的项目正在使用:

    @nativescript/core: ~8.0.0
    

    然后:ns clean

    【讨论】:

      猜你喜欢
      • 2021-08-11
      • 2020-01-15
      • 2021-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-19
      • 2021-12-11
      • 2020-06-22
      相关资源
      最近更新 更多