ng2 translate does not work with webpack
See original GitHub issueFor reducing the start time of the application, I have configured webpack in my application . But after that ng2 translate is not working and I am getting the error ERROR Error: Uncaught (in promise): Response with status: 200 for URL: null
“ng2-translate”: “^5.0.0”,
app.module.ts
export function createTranslateLoader(http: Http) {
return new TranslateHttpLoader(http, './assets/i18n', '.json');
}
@NgModule({
declarations: [AppComponent],
bootstrap: [AppComponent],
imports: [
NativeScriptModule,
NativeScriptHttpModule,
NativeScriptUIListViewModule,
NativeScriptFormsModule,
NativeScriptUISideDrawerModule,
NativeScriptRouterModule,
NativeScriptRouterModule.forRoot(routes),
TranslateModule.forRoot({
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [Http]
})
],
In webpack.config.js I have added
new CopyWebpackPlugin([
{from: mainSheet},
{from: "css/**"},
{from: "fonts/**"},
{from: "**/*.jpg"},
{from: "**/*.png"},
{from: "**/*.xml"},
**{from: "i18n/*.json"},**
{from: "**/*.json"},
], {ignore: ["App_Resources/**"]}),
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Ng2-translate and webpack - Stack Overflow
Good that you provided a example project, I was able to quickly review it and looks like you are using latest version of...
Read more >webpack/webpack - Gitter
Hi guys, I got a problem with webpack and angular 2. I have created a component and uploaded it on npm. Then I...
Read more >How to translate your Angular app with ngx-translate
1. Add ngx-translate to your Angular application 2. Set up the TranslateService in your app.module.ts 3. Create your main language translation file (in...
Read more >ng2-translate - npm Package Health Analysis - Snyk
The npm package ng2-translate was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as...
Read more >[Solved]-Ng2-translate and webpack - appsloveworld
In Xcode, how to not run certain Run Script Build Phases when running Tests? Caching images in memory on iOS, what is smaller...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had a similar issue a few hours ago, if your translation json is inside the folder app/assets/i18n add the next line to your CopyWebpackPlugin { from: “assets/i18n/*.json” }
@Shifs did you solve this issue ?