question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSON files are not loading:getting 404 error with webpack

See original GitHub issue

I’m submitting a … (check one with “x”)

[ ] bug report => check the FAQ and search github for a similar issue or PR before submitting
[ ] support request => check the FAQ and search github for a similar issue before submitting
[ ] feature request

Current behavior

I’m using webpack with ng2-translate and JSON files (ex-en.json, fr.json) are not picking up.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
ht89commented, Nov 18, 2016

@yogesh51 If you follow the guide of ng2-translate correctly, you will know that you need to put this (the lines in bold below) in app.module.ts to point to the public folder that stores the JSON files.

@NgModule({ imports: [ BrowserModule, AuthModule, HomeModule, CoreModule.forRoot(), AppRoutingModule, TranslateModule.forRoot({ provide: TranslateLoader, useFactory: (http: Http) => new TranslateStaticLoader(http, ‘dist/assets/i18n’, ‘.json’), deps: [Http] }) ], declarations: [AppComponent, HeaderComponent, FooterComponent, AsideComponent], bootstrap: [AppComponent] })

2reactions
ht89commented, Nov 17, 2016

You should install Copy Webpack Plugin in this link Copy Webpack Plugin. It’s used to copy files from a source to another. I tried it and now angular can find the JSON files.

The important lines to notice are these: new CopyWebpackPlugin([ { from: 'src/assets/i18n', to: 'assets/i18n' } ])

replace the from with the folder that stores your JSON files

Read more comments on GitHub >

github_iconTop Results From Across the Web

hot-update.json 404 (Not Found) · Issue #1385 - GitHub
When I save a change in a js file a request is made for application.bundle.js:33 GET https://broker-gateway.firstbanco.dev/1a00a5ecc216afcb2106.
Read more >
Json file was not found by webpack - Stack Overflow
a question "Load static JSON file in Webpack" do not solve my problem and with json-loader or not this issue still present.
Read more >
Error: GET https://localhost:8080/assets/status 404 (Not Found)
Solved: Hi, I'm trying to create a new visual and for it I need to use a webpack.config.js for exclude node_modules. But when...
Read more >
Loading reports as modules - GrapeCity
Missing report templates cause compilation errors instead of Not Found errors for ... supplying custom modules, like *.rdlx-json files with strong typing.
Read more >
json-loader - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found