-
Notifications
You must be signed in to change notification settings - Fork 12k
[app-shell] ng build -prod Unexpected token export #8848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Removing locale definition in AppModule and using --locale instead on cli seems to solve this issue but should be fine to understand why the content of localeFr blocks the parsing any way. Cheers. |
Are you able to build the server app independently?
|
Hi @Brocco, yes, I am.
|
Hi, |
No. I've just removed the provider and use |
@Skonx In my case, the error is not the locale. I guess there is a correlation with "useValue" in providers. Date: 2018-01-24T16:24:40.495Z SyntaxError: Unexpected token import |
This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please? You can read here why this is needed. A good way to make a minimal repro is to create a new app via |
Hi there. Basically, it should display a mat-date-picker with french format. |
Date: 2018-02-23T18:29:33.682Z |
ng version
/ \ _ __ __ _ _ | | __ _ _ __ / | | | | Angular CLI: 1.7.1 @angular/cdk: 5.2.2 |
I am not sure if it is same issue lik emine but i am able to build project with SSR but when trying to build app-shell i got error Unexpected token import i know this is because import in one of libraries but cannot get why because same imports used evevn in ng forms + project builds fine (browser and server) normally. |
We moved to webpack 4 a while back which should support import and export keywords. I'm closing this as fixed. If you think this is still happening, please file a new issue. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
ng build -prod produces the following error :
ng build -prod
Date: 2017-12-12T14:49:37.929Z
Hash: 4d60263954c3747c95b5
Time: 107922ms
chunk {0} 0.099b11ca3eb0d7801c76.chunk.js (common) 95 kB [rendered]
chunk {1} 1.5e38cc6f9b8fc746d27f.chunk.js () 3.85 kB [rendered]
chunk {2} 2.02a1a1877b3701e42d92.chunk.js () 92.5 kB [rendered]
chunk {3} 3.206ef7db82003266beed.chunk.js () 31.8 kB [rendered]
chunk {4} 4.e4f93b0588db95625db7.chunk.js () 3.56 kB [rendered]
chunk {5} 5.f2a2a15e9becbf222fb7.chunk.js () 3.59 kB [rendered]
chunk {6} 6.2697f6d4ddacf8b1ad3f.chunk.js () 3.57 kB [rendered]
chunk {7} 7.9b8422429e3ca93f2129.chunk.js () 87.5 kB [rendered]
chunk {8} 8.fee4bb159e55adb3b228.chunk.js () 3.63 kB [rendered]
chunk {9} 9.d0fe86cfa48e90d50792.chunk.js () 3.57 kB [rendered]
chunk {10} 10.51afbe17591fb56cc5cc.chunk.js () 1.48 kB [rendered]
chunk {11} 11.ba3968b01c53404c212f.chunk.js () 9.69 kB [rendered]
chunk {12} main.720cf8da75e50077b111.bundle.js (main) 1.21 MB [initial] [rendered]
chunk {13} polyfills.8ec93566c689cefbeab1.bundle.js (polyfills) 61 kB [initial] [rendered]
chunk {14} styles.ab4e27ce710a9e61640c.bundle.css (styles) 45 kB [initial] [rendered]
chunk {15} inline.7b3f406ccd40bedad9e5.bundle.js (inline) 1.75 kB [entry] [rendered]
Date: 2017-12-12T14:50:17.701Z
Hash: 731c78bb935196096ae1
Time: 39523ms
chunk {0} main.034865b9801ae4e3c5d0.bundle.js (main) 731 kB [entry] [rendered]
chunk {1} polyfills.49f00aadbe49adb42f32.bundle.js (polyfills) 788 bytes [entry] [rendered]
chunk {2} styles.ab4e27ce710a9e61640c.bundle.css (styles) 45 kB [entry] [rendered]
Unexpected token export
/Users/jsie/Projects/comptandye/dev/comptandye_frontend/webapp/node_modules/@angular/common/locales/fr.js:10
export default [
^^^^^^
SyntaxError: Unexpected token export
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.fYTv (/Users/jsie/Projects/comptandye/dev/comptandye_frontend/webapp/dist-server/main.034865b9801ae4e3c5d0.bundle.js:1:408157)
at l (/Users/jsie/Projects/comptandye/dev/comptandye_frontend/webapp/dist-server/main.034865b9801ae4e3c5d0.bundle.js:1:211)
at Object.aR8+ (/Users/jsie/Projects/comptandye/dev/comptandye_frontend/webapp/dist-server/main.034865b9801ae4e3c5d0.bundle.js:1:263541)
at l (/Users/jsie/Projects/comptandye/dev/comptandye_frontend/webapp/dist-server/main.034865b9801ae4e3c5d0.bundle.js:1:211)
at Object.JwoV (/Users/jsie/Projects/comptandye/dev/comptandye_frontend/webapp/dist-server/main.034865b9801ae4e3c5d0.bundle.js:1:152280)
at l (/Users/jsie/Projects/comptandye/dev/comptandye_frontend/webapp/dist-server/main.034865b9801ae4e3c5d0.bundle.js:1:211)
at Object.Zq8w (/Users/jsie/Projects/comptandye/dev/comptandye_frontend/webapp/dist-server/main.034865b9801ae4e3c5d0.bundle.js:1:252141)
Versions
Desired behavior
Should generate dist and dist-server without errors :-)
Mention any other details that might be useful (optional)
In AppModule :
(...)
// uses locale FR
import { registerLocaleData } from '@angular/common';
import localeFr from '@angular/common/locales/fr';
import { MAT_DATE_LOCALE } from '@angular/material';
registerLocaleData(localeFr);
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
CoreModule,
SharedModule,
LoginModule,
AppRoutingModule
],
providers: [{ provide: MAT_DATE_LOCALE, useValue: 'fr-FR' }],
bootstrap: [AppComponent]
})
export class AppModule { }
The text was updated successfully, but these errors were encountered: