JSON files are not loading:getting 404 error with webpack
See original GitHub issueI’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:
- Created 7 years ago
- Comments:6
Top 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 >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
@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] })
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