2017-08-17 46 views
0

您好我有一个Web应用程序建立在Aurelia CLI上。为了解决性能问题(我解决了here),我更新了最新版本的Aurelia(0.30.1,修复了性能问题)。要做到这一点,我不得不更新其他NPM包,迫使semver到可用的最新版本使用NPM-签更新包第一Aurelia为生产构建创建捆绑“undefined”作为内容

npm install -g npm-check-updates 
ncu --upgrade 
npm update 
npm install babel-runtime --save-dev 
npm install timers-ext --save-dev 
npm install gulp-sourcemaps --save-dev 
npm install aurelia-pal --save-dev 
npm install aurelia-binding --save-dev 
npm install aurelia-templating --save-dev 

这是我aurelia.json文件

{ 
"name": "XX.YY.Web", 
    "type": "project:application", 
    "platform": { 
    "id": "web", 
    "displayName": "Web", 
    "output": "scripts", 
    "index": "index.html" 
    }, 
    "transpiler": { 
    "id": "babel", 
    "displayName": "Babel", 
    "fileExtension": ".js", 
    "options": { 
     "plugins": [ 
     "transform-es2015-modules-amd" 
     ] 
    }, 
    "source": "src\\**\\*.js" 
    }, 
    "markupProcessor": { 
    "id": "none", 
    "displayName": "None", 
    "fileExtension": ".html", 
    "source": "src\\**\\*.html" 
    }, 
    "cssProcessor": { 
    "id": "none", 
    "displayName": "None", 
    "fileExtension": ".css", 
    "source": "src\\**\\*.css" 
    }, 
    "editor": { 
    "id": "vscode", 
    "displayName": "Visual Studio Code" 
    }, 
    "unitTestRunner": { 
    "id": "karma", 
    "displayName": "Karma", 
    "source": "test\\unit\\**\\*.js" 
    }, 
    "paths": { 
    "root": "src" 
    }, 
    "testFramework": { 
    "id": "jasmine", 
    "displayName": "Jasmine" 
    }, 
    "build": { 
    "targets": [ 
     { 
     "id": "web", 
     "displayName": "Web", 
     "output": "scripts", 
     "index": "scripts/index.html", 
     "useAbsolutePath": true 
     } 
    ], 
    "loader": { 
     "type": "require", 
     "configTarget": "vendor-bundle.js", 
     "includeBundleMetadataInConfig": "auto", 
     "config": { 
     "waitSeconds": 0, 
     "paths": { 
      "jquery": "../scripts/lib/cdn/jquery-3.1.0.min", 
      "breeze-client": "../node_modules/breeze-client/breeze.debug" 
     } 
     }, 
     "plugins": [ 
     { 
      "name": "text", 
      "extensions": [ 
      ".html", 
      ".css" 
      ], 
      "stub": true 
     } 
     ] 
    }, 
    "options": { 
     "minify": "stage & prod", 
     "sourcemaps": "dev & stage", 
     "rev": "stage & prod" 
    }, 
    "bundles": [ 
     { 
     "name": "app-bundle.js",   
     "source": [ 
      "[**/*.js]", 
      "**/*.{css,html}" 
     ] 
     }, 
     { 
     "name": "vendor-bundle.js", 
     "prepend": [ 
      "node_modules/bluebird/js/browser/bluebird.core.js",   
      "scripts/lib/require.js" 
     ], 
     "dependencies": [ 
      "aurelia-binding", 
      "aurelia-bootstrapper", 
      "aurelia-dependency-injection", 
      "aurelia-event-aggregator", 
      "aurelia-fetch-client", 
      "aurelia-framework", 
      "aurelia-history", 
      "aurelia-history-browser", 
      "aurelia-loader", 
      "aurelia-loader-default", 
      "aurelia-logging", 
      "aurelia-logging-console", 
      "aurelia-metadata", 
      "aurelia-pal", 
      "aurelia-pal-browser", 
      "aurelia-path", 
      "aurelia-polyfills", 
      "aurelia-route-recognizer", 
      "aurelia-router", 
      "aurelia-task-queue", 
      "aurelia-templating", 
      "aurelia-templating-binding", 
      { 
      "name": "text", 
      "path": "../scripts/lib/text", 
      "packageRoot": "../scripts/lib" 
      }, 
      { 
      "name": "aurelia-templating-resources", 
      "path": "../node_modules/aurelia-templating-resources/dist/amd", 
      "main": "aurelia-templating-resources" 
      }, 
      { 
      "name": "aurelia-templating-router", 
      "path": "../node_modules/aurelia-templating-router/dist/amd", 
      "main": "aurelia-templating-router" 
      }, 
      { 
      "name": "aurelia-breeze", 
      "path": "../node_modules/aurelia-breeze/dist/amd", 
      "main": "aurelia-breeze" 
      }, 
      { 
      "name": "breeze-client", 
      "path": "../node_modules/breeze-client", 
      "main": "breeze.debug" 
      }, 
      { 
      "name": "whatwg-fetch", 
      "path": "../node_modules/whatwg-fetch", 
      "main": "fetch" 
      }, 
      { 
      "name": "aurelia-testing", 
      "path": "../node_modules/aurelia-testing/dist/amd", 
      "main": "aurelia-testing", 
      "env": "dev" 
      }, 
      { 
      "name": "icheck", 
      "path": "../node_modules/icheck", 
      "main": "icheck.min" 
      }, 
      { 
      "name": "filesaver.js", 
      "path": "../node_modules/filesaver.js", 
      "main": "FileSaver.min" 
      } 
     ] 
     } 
    ] 
    } 
} 

我现在有一个问题。如果我运行

au build 

au run –watch 

我没有问题。 如果我运行

au build –env prod 

创建APP-和供应商bundle- [标识] .js文件,我没有得到任何错误,但是这两个文件最终创建空的,或者更确切地说,只是“未定义“。

Node.js的版本:6.11.2(目前最新的稳定)

NPM版本:3.10.10

有没有人有一个想法?它是否与缩小机制有关(在开发中没有发生)

如何调试/记录发生了什么问题?

UPDATE:

我已经激活缩小文件也是在aurelia.json文件的开发环境,这是我得到

Failed to write the bundle 
SyntaxError: Unexpected token u in JSON at position 0 
    at Object.parse (native) 
    at new Converter (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:42:48) 
    at Object.exports.fromJSON (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:96:10) 
    at work.then (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\bundle.js:259:48) 
    at process._tickDomainCallback (internal/process/next_tick.js:135:7) 
{ uid: 8, 
    name: 'writeBundles', 
    branch: false, 
    error: 
    SyntaxError: Unexpected token u in JSON at position 0 
     at Object.parse (native) 
     at new Converter (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:42:48) 
     at Object.exports.fromJSON (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:96:10) 
     at work.then (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\bundle.js:259:48) 
     at process._tickDomainCallback (internal/process/next_tick.js:135:7), 
    duration: [ 5, 639721541 ], 
    time: 1502969144275 } 
{ uid: 0, 
    name: '<series>', 
    branch: true, 
    error: 
    SyntaxError: Unexpected token u in JSON at position 0 
     at Object.parse (native) 
     at new Converter (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:42:48) 
     at Object.exports.fromJSON (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:96:10) 
     at work.then (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\bundle.js:259:48) 
     at process._tickDomainCallback (internal/process/next_tick.js:135:7), 
    duration: [ 47, 444524559 ], 
    time: 1502969144277 } 
SyntaxError: Unexpected token u in JSON at position 0 
    at Object.parse (native) 
    at new Converter (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:42:48) 
    at Object.exports.fromJSON (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\convert-source-map\index.js:96:10) 
    at work.then (E:\Code\Application\XX-dev\XX.YY.Web\node_modules\aurelia-cli\lib\build\bundle.js:259:48) 
    at process._tickDomainCallback (internal/process/next_tick.js:135:7) 

如果我激活dev的缩小,这是行不通的要么给我上面粘贴的错误。如果我也删除源地图,它不起作用(两个包都未定义),但没有错误消息。

回答

0

升级至奥里利亚-CLI NPM模块(0.31.3)和所有其他模块的最新版本,最新版本解决了该问题

0

我想你现在可以做au build(不--env prod标志。

+0

thanx的提示,但不,这个问题只发生在prod中,我认为它是由缩小造成的,因为如果我打开它也为dev它不工作 –

+0

对不起,我也应该离开这个作为评论而不是回答,因为这只是一个猜测。 – LStarky

相关问题