我正在尝试将我的应用设置为使用aot并同时丑化。我可以使用--bundle进行编译,但是一旦添加--env.aot或--env.uglify,我就无法对其进行编译。使用AOT,我几乎消除了所有错误。我看到的唯一错误是它找不到模板,并且路径错误。不过我不明白。我正在使用带有module.id的相对路径。
@Component({
moduleId: module.id,
selector: 'test-radio',
templateUrl: './test-radio.component.html',
styleUrls: ['./test-radio.component.css']
})
我构建时的错误是:
JavaScript error:
file:///app/vendor.js:128056:103: JS ERROR Error: Could not resolve
test-radio.component.html. Looked for:
/Users/brice/Library/Developer/CoreSimulator/Devices/61560E27-9F8D-
430F-81D9-437A2E329F52/data/Containers/Bundle/Application/74041BF3-
8493-4EF2-BE46-F72257CC5C83/class2tns.app/app/test-radio.component.html.
但在出现此错误之前,有所有这些东西:
ERROR in : Error: Cannot find module '@ngtools/webpack/src/utils'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (/Users/brice/source/class2tns/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.getResolvedEntryModule (/Users/brice/source/class2tns/node_modules/nativescript-dev-webpack/utils/transformers-utils.js:10:35)
at standardTransform (/Users/brice/source/class2tns/node_modules/nativescript-dev-webpack/transformers/ns-replace-bootstrap.js:16:50)
at transformer (/Users/brice/source/class2tns/node_modules/@ngtools/webpack/src/transformers/make_transform.js:21:25)
at /Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:1390:86
at reduceLeft (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:1102:30)
at /Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:1390:42
at transformRoot (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:81154:82)
at Object.map (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:429:29)
at Object.transformNodes (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:81141:30)
at emitJsFileOrBundle (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:81497:32)
at emitSourceFileOrBundle (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:81465:13)
at forEachEmittedFile (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:81373:30)
at Object.emitFiles (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:81454:9)
at emitWorker (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:86927:33)
at /Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:86887:66
at runWithCancellationToken (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:86979:24)
at Object.emit (/Users/brice/source/class2tns/node_modules/typescript/lib/typescript.js:86887:20)
at defaultEmitCallback (/Users/brice/source/class2tns/node_modules/@angular/compiler-cli/src/transformers/program.js:67:24)
at AngularCompilerProgram._emitRender2 (/Users/brice/source/class2tns/node_modules/@angular/compiler-cli/src/transformers/program.js:388:34)
at AngularCompilerProgram.emit (/Users/brice/source/class2tns/node_modules/@angular/compiler-cli/src/transformers/program.js:212:22)
at AngularCompilerPlugin._emit (/Users/brice/source/class2tns/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:850:49)
at Promise.resolve.then.then.then (/Users/brice/source/class2tns/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:676:54)
at process._tickCallback (internal/process/next_tick.js:68:7)
运行:
NativeScript CLI版本:5.4.1 CLI扩展nativescript-cloud版本:1.17.6 CLI扩展nativescript-starter-kits版本:0.3.5