aurelia / cli

The Aurelia 1 command line tool. Use the CLI to create projects, scaffold components, and bundle your app for release.
MIT License
407 stars 133 forks source link

The export keyword can only be used with the module goal #1198

Closed nenadvicentic closed 2 years ago

nenadvicentic commented 2 years ago

I'm submitting a bug report

Please tell us about your environment:

Current behavior: After upgrade from Aurelia CLI 2.0.3 to 3.0.1, au build breaks with the message:

ParseError [SyntaxError]: [241:6]: The export keyword can only be used with the module goal

Full stack trace:

ERROR [BundledSource] Could not convert to AMD module, skipping WebSite\ClientApp\node_modules\latlon-geohash\latlon-geohash.js
ERROR [BundledSource] Error was: Error: Cannot find module '@babel/plugin-transform-modules-amd'
Require stack:
- WebSite\ClientApp\node_modules\aurelia-cli\node_modules\@babel\core\lib\config\files\plugins.js
- WebSite\ClientApp\node_modules\aurelia-cli\node_modules\@babel\core\lib\config\files\index.js
- WebSite\ClientApp\node_modules\aurelia-cli\node_modules\@babel\core\lib\index.js
- WebSite\ClientApp\node_modules\aurelia-cli\lib\build\amodro-trace\read\es.js
- WebSite\ClientApp\node_modules\aurelia-cli\lib\build\bundled-source.js
- WebSite\ClientApp\node_modules\aurelia-cli\lib\build\bundler.js
- WebSite\ClientApp\node_modules\aurelia-cli\lib\build\index.js
- WebSite\ClientApp\node_modules\aurelia-cli\lib\index.js
- C:\Users\nvicentic\AppData\Roaming\npm\node_modules\aurelia-cli\bin\aurelia-cli.js
ERROR [Bundler] Failed to do transforms
INFO [Bundler] SyntaxError: [241:6]: The export keyword can only be used with the module goal
{
  uid: 10,
  name: 'writeBundles',
  branch: false,
  error: ParseError [SyntaxError]: [241:6]: The export keyword can only be used with the module goal
      at report (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:185:11)
      at parseStatementListItem (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:4860:13)
      at parseStatementList (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:4809:25)
      at parseSource (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:4776:16)
      at Object.parseScript (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:8775:12)
      at Function.parse.usesAmdOrRequireJs (WebSite\ClientApp\node_modules\aurelia-cli\lib\build\amodro-trace\lib\parse.js:553:26)
      at WebSite\ClientApp\node_modules\aurelia-cli\lib\build\amodro-trace\write\defines.js:57:28
      at WebSite\ClientApp\node_modules\aurelia-cli\lib\build\amodro-trace\write\all.js:27:14
      at Array.reduce (<anonymous>)
      at WebSite\ClientApp\node_modules\aurelia-cli\lib\build\amodro-trace\write\all.js:26:29 {
    index: 8378,
    line: 241,
    column: 6,
    description: '[241:6]: The export keyword can only be used with the module goal',
    loc: { line: 241, column: 6 }
  },
  duration: [ 0, 794769700 ],
  time: 1658846812804
}
{
  uid: 0,
  name: '<series>',
  branch: true,
  error: ParseError [SyntaxError]: [241:6]: The export keyword can only be used with the module goal
      at report (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:185:11)
      at parseStatementListItem (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:4860:13)
      at parseStatementList (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:4809:25)
      at parseSource (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:4776:16)
      at Object.parseScript (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:8775:12)
      at Function.parse.usesAmdOrRequireJs (WebSite\ClientApp\node_modules\aurelia-cli\lib\build\amodro-trace\lib\parse.js:553:26)
      at WebSite\ClientApp\node_modules\aurelia-cli\lib\build\amodro-trace\write\defines.js:57:28
      at WebSite\ClientApp\node_modules\aurelia-cli\lib\build\amodro-trace\write\all.js:27:14
      at Array.reduce (<anonymous>)
      at WebSite\ClientApp\node_modules\aurelia-cli\lib\build\amodro-trace\write\all.js:26:29 {
    index: 8378,
    line: 241,
    column: 6,
    description: '[241:6]: The export keyword can only be used with the module goal',
    loc: { line: 241, column: 6 }
  },
  duration: [ 3, 636796700 ],
  time: 1658846812808
}
ParseError [SyntaxError]: [241:6]: The export keyword can only be used with the module goal
    at report (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:185:11)
    at parseStatementListItem (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:4860:13)
    at parseStatementList (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:4809:25)
    at parseSource (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:4776:16)
    at Object.parseScript (WebSite\ClientApp\node_modules\meriyah\dist\meriyah.cjs:8775:12)
    at Function.parse.usesAmdOrRequireJs (WebSite\ClientApp\node_modules\aurelia-cli\lib\build\amodro-trace\lib\parse.js:553:26)
    at WebSite\ClientApp\node_modules\aurelia-cli\lib\build\amodro-trace\write\defines.js:57:28
    at WebSite\ClientApp\node_modules\aurelia-cli\lib\build\amodro-trace\write\all.js:27:14
    at Array.reduce (<anonymous>)
    at WebSite\ClientApp\node_modules\aurelia-cli\lib\build\amodro-trace\write\all.js:26:29 {
  index: 8378,
  line: 241,
  column: 6,
  description: '[241:6]: The export keyword can only be used with the module goal',
  loc: { line: 241, column: 6 }
}
3cp commented 2 years ago

Cannot find module '@babel/plugin-transform-modules-amd'

Sounds like your node_modules is broken. Can you try clean them up (plus lock file) and try again?

3cp commented 2 years ago

FYI, that babel amd package is a dep of aurelia-cli.

huocp@Chunpengs-MacBook-Pro ~/p/at> npm ls @babel/plugin-transform-modules-amd
at@0.1.0 /Users/huocp/playground/at
└─┬ aurelia-cli@3.0.1
  └── @babel/plugin-transform-modules-amd@7.18.6
nenadvicentic commented 2 years ago

@3cp After removing complete node_modules folder and yarn.lock file, then re-running yarn, au build started to work.

3cp commented 2 years ago

Cheers