Aurelia build for production使用“创建捆绑包”;“未定义”;作为内容

Aurelia build for production使用“创建捆绑包”;“未定义”;作为内容,aurelia,Aurelia,嗨,我有一个基于Aurelia CLI构建的web应用程序。为了解决性能问题(我已经解决了),我更新了最新版本的Aurelia(0.30.1,它解决了性能问题)。要做到这一点,我必须更新其他npm包,首先使用npm check updates包强制semver更新到可用的最新版本 npm install -g npm-check-updates ncu --upgrade npm update npm install babel-runtime --save-dev npm install ti

嗨,我有一个基于Aurelia CLI构建的web应用程序。为了解决性能问题(我已经解决了),我更新了最新版本的Aurelia(0.30.1,它解决了性能问题)。要做到这一点,我必须更新其他npm包,首先使用npm check updates包强制semver更新到可用的最新版本

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 build –env prod

我没有问题。 如果我跑

au build 
au build –env prod
要创建应用程序包和供应商包-[identifier].js,我没有收到任何错误,但这两个文件最终都是空的,或者只是其中有“undefined”

Node.js版本:6.11.2(当前最新版本)

NPM版本:3.10.10

有人有主意吗?它是否与缩小机制有关(在dev中不会发生这种情况)

如何调试/记录发生的错误

更新:

我已经在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)
未能写入捆绑包
SyntaxError:JSON中位于位置0的意外标记u
at Object.parse(本机)
在新的转换器上(E:\Code\Application\XX dev\XX.YY.Web\node\u modules\aurelia cli\lib\build\convert source map\index.js:42:48)
在Object.exports.fromJSON(E:\Code\Application\XX dev\XX.YY.Web\node\u modules\aurelia cli\lib\build\convert source map\index.js:96:10)
然后(E:\Code\Application\XX dev\XX.YY.Web\node\u modules\aurelia cli\lib\build\bundle.js:259:48)
在进程中。_tickDomainCallback(internal/process/next_tick.js:135:7)
{uid:8,
名称:“writeBundles”,
分行:错,
错误:
SyntaxError:JSON中位于位置0的意外标记u
at Object.parse(本机)
在新的转换器上(E:\Code\Application\XX dev\XX.YY.Web\node\u modules\aurelia cli\lib\build\convert source map\index.js:42:48)
在Object.exports.fromJSON(E:\Code\Application\XX dev\XX.YY.Web\node\u modules\aurelia cli\lib\build\convert source map\index.js:96:10)
然后(E:\Code\Application\XX dev\XX.YY.Web\node\u modules\aurelia cli\lib\build\bundle.js:259:48)
在进程中。_tickDomainCallback(internal/process/next_tick.js:135:7),
持续时间:[5639721541],
时间:1502969144275}
{uid:0,
名称:“”,
布兰奇:没错,
错误:
SyntaxError:JSON中位于位置0的意外标记u
at Object.parse(本机)
在新的转换器上(E:\Code\Application\XX dev\XX.YY.Web\node\u modules\aurelia cli\lib\build\convert source map\index.js:42:48)
在Object.exports.fromJSON(E:\Code\Application\XX dev\XX.YY.Web\node\u modules\aurelia cli\lib\build\convert source map\index.js:96:10)
然后(E:\Code\Application\XX dev\XX.YY.Web\node\u modules\aurelia cli\lib\build\bundle.js:259:48)
在进程中。_tickDomainCallback(internal/process/next_tick.js:135:7),
持续时间:[47444524559],
时间:1502969144277}
SyntaxError:JSON中位于位置0的意外标记u
at Object.parse(本机)
在新的转换器上(E:\Code\Application\XX dev\XX.YY.Web\node\u modules\aurelia cli\lib\build\convert source map\index.js:42:48)
在Object.exports.fromJSON(E:\Code\Application\XX dev\XX.YY.Web\node\u modules\aurelia cli\lib\build\convert source map\index.js:96:10)
然后(E:\Code\Application\XX dev\XX.YY.Web\node\u modules\aurelia cli\lib\build\bundle.js:259:48)
在进程中。_tickDomainCallback(internal/process/next_tick.js:135:7)

如果我为dev激活缩小,它也不起作用,给出了我上面粘贴的错误。如果我同时删除sourcemaps,它将不起作用(两个包都未定义),但不会出现错误消息。

我认为您现在可以执行
au build
(无
--env prod
标志。

升级到最新版本的aurelia cli npm模块(0.31.3)所有其他模块的最新版本都解决了这个问题。

thanx提示一下,但不是,这个问题只发生在prod中,我认为这是由缩小造成的,因为如果我也为dev打开它,它就不起作用了。对不起,我也应该把它作为一个注释而不是答案,因为这只是一个猜测。