'import' and 'export' may appear only with 'sourceType: module
I get this error when using it with aot.
SyntaxError: node_modules/@angular/flex-layout/utils/basis-validator.js: 'import' and 'export' may appear only with 'sourceType: module' (19:4)
17 | * Use of this source code is governed by an MIT-style license that can be
18 | * found in the LICENSE file at https://angular.io/license
> 19 | */ export function validateBasis(basis, grow, shrink) {
| ^
20 | if (grow === void 0) { grow = "1"; }
21 | if (shrink === void 0) { shrink = "1"; }
22 | var parts = [grow, shrink, basis];
at Parser.pp$5.raise (/Users/praveen/Works/pkp.io-2/node_modules/babylon/lib/index.js:4454:13)
at Parser.pp$1.parseStatement (/Users/praveen/Works/pkp.io-2/node_modules/babylon/lib/index.js:1881:16)
at Parser.pp$1.parseBlockBody (/Users/praveen/Works/pkp.io-2/node_modules/babylon/lib/index.js:2268:21)
at Parser.pp$1.parseTopLevel (/Users/praveen/Works/pkp.io-2/node_modules/babylon/lib/index.js:1778:8)
at Parser.parse (/Users/praveen/Works/pkp.io-2/node_modules/babylon/lib/index.js:1673:17)
at parse (/Users/praveen/Works/pkp.io-2/node_modules/babylon/lib/index.js:7234:37)
at File.parse (/Users/praveen/Works/pkp.io-2/node_modules/babel-core/lib/transformation/file/index.js:517:15)
at File.parseCode (/Users/praveen/Works/pkp.io-2/node_modules/babel-core/lib/transformation/file/index.js:602:20)
at /Users/praveen/Works/pkp.io-2/node_modules/babel-core/lib/transformation/pipeline.js:49:12
at File.wrap (/Users/praveen/Works/pkp.io-2/node_modules/babel-core/lib/transformation/file/index.js:564:16)
at Pipeline.transform (/Users/praveen/Works/pkp.io-2/node_modules/babel-core/lib/transformation/pipeline.js:47:17)
at Object.exports.compile (/Users/praveen/Works/pkp.io-2/node_modules/systemjs-builder/compilers/compiler.js:30:20)
at Object.exports.compile (/Users/praveen/Works/pkp.io-2/node_modules/systemjs-builder/compilers/global.js:14:19)
at /Users/praveen/Works/pkp.io-2/node_modules/systemjs-builder/lib/compile.js:117:43
at tryCatcher (/Users/praveen/Works/pkp.io-2/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/praveen/Works/pkp.io-2/node_modules/bluebird/js/release/promise.js:512:31)
[10:58:38] 'build.prod.aot' errored after 36 s
[10:58:38] SyntaxError in plugin 'run-sequence(build.bundles.app.aot)'
Message:
Error compiling global module "@angular/flex-layout/utils/basis-validator.js" at node_modules/@angular/flex-layout/utils/basis-validator.js
node_modules/@angular/flex-layout/utils/basis-validator.js: 'import' and 'export' may appear only with 'sourceType: module' (19:4)
Details:
pos: 529
loc: [object Object]
_babel: true
codeFrame: 17 | * Use of this source code is governed by an MIT-style license that can be
18 | * found in the LICENSE file at https://angular.io/license
> 19 | */ export function validateBasis(basis, grow, shrink) {
| ^
20 | if (grow === void 0) { grow = "1"; }
21 | if (shrink === void 0) { shrink = "1"; }
22 | var parts = [grow, shrink, basis];
Stack:
SyntaxError: node_modules/@angular/flex-layout/utils/basis-validator.js: 'import' and 'export' may appear only with 'sourceType: module' (19:4)
17 | * Use of this source code is governed by an MIT-style license that can be
18 | * found in the LICENSE file at https://angular.io/license
> 19 | */ export function validateBasis(basis, grow, shrink) {
| ^
20 | if (grow === void 0) { grow = "1"; }
21 | if (shrink === void 0) { shrink = "1"; }
22 | var parts = [grow, shrink, basis];
at Parser.pp$5.raise (/Users/praveen/Works/pkp.io-2/node_modules/babylon/lib/index.js:4454:13)
at Parser.pp$1.parseStatement (/Users/praveen/Works/pkp.io-2/node_modules/babylon/lib/index.js:1881:16)
at Parser.pp$1.parseBlockBody (/Users/praveen/Works/pkp.io-2/node_modules/babylon/lib/index.js:2268:21)
at Parser.pp$1.parseTopLevel (/Users/praveen/Works/pkp.io-2/node_modules/babylon/lib/index.js:1778:8)
at Parser.parse (/Users/praveen/Works/pkp.io-2/node_modules/babylon/lib/index.js:1673:17)
at parse (/Users/praveen/Works/pkp.io-2/node_modules/babylon/lib/index.js:7234:37)
at File.parse (/Users/praveen/Works/pkp.io-2/node_modules/babel-core/lib/transformation/file/index.js:517:15)
at File.parseCode (/Users/praveen/Works/pkp.io-2/node_modules/babel-core/lib/transformation/file/index.js:602:20)
at /Users/praveen/Works/pkp.io-2/node_modules/babel-core/lib/transformation/pipeline.js:49:12
at File.wrap (/Users/praveen/Works/pkp.io-2/node_modules/babel-core/lib/transformation/file/index.js:564:16)
at Pipeline.transform (/Users/praveen/Works/pkp.io-2/node_modules/babel-core/lib/transformation/pipeline.js:47:17)
at Object.exports.compile (/Users/praveen/Works/pkp.io-2/node_modules/systemjs-builder/compilers/compiler.js:30:20)
at Object.exports.compile (/Users/praveen/Works/pkp.io-2/node_modules/systemjs-builder/compilers/global.js:14:19)
at /Users/praveen/Works/pkp.io-2/node_modules/systemjs-builder/lib/compile.js:117:43
at tryCatcher (/Users/praveen/Works/pkp.io-2/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/praveen/Works/pkp.io-2/node_modules/bluebird/js/release/promise.js:512:31)
npm ERR! Darwin 16.5.0
npm ERR! argv "/usr/local/Cellar/node/7.9.0/bin/node" "/usr/local/bin/npm" "run" "build.prod.aot"
npm ERR! node v7.9.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build.prod.aot: `gulp build.prod.aot --color --env-config prod --build-type prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build.prod.aot script 'gulp build.prod.aot --color --env-config prod --build-type prod'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp build.prod.aot --color --env-config prod --build-type prod
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular-seed
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular-seed
npm ERR! There is likely additional logging output above.
Repro: Checkout https://github.com/praveendath92/pkp.io-2 and run
npm install
npm run build.prod.aot
For the record, I saw #178 and tried out some of the suggestions there in without success.
I am also seeing the same error. @praveendath92 and I are using angular-seed project as a starter project. Non-Aot build seems to work fine
@aroop, Yes, I am. You mean the one with build.prod ?
@praveendath92 Correct build.prod seems to work fine for me
I just verified. It works for me too. So, it's just aot then. On a different note, I have another question about the seed, could you help me out?
I can give it a try
AOT with Latest Angular 4.x is NOT working yet. See #299
Related to #299
@ThomasBurleson Thanks for the clarification. Closing this as duplicate. Will follow progress on the original issue.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.