# Local server vs Webpack dev server (static files)

**URL:** <https://community.localwp.com/t/local-server-vs-webpack-dev-server-static-files/28402>\
**Category:** Support\
**Created:** [October 20, 2021, 4:59pm UTC](https://community.localwp.com/t/local-server-vs-webpack-dev-server-static-files/28402 "2021-10-20T16:59:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aresh](https://avatars.discourse-cdn.com/v4/letter/a/b38774/32.png) [@Aresh](https://community.localwp.com/u/Aresh)\
**Post date:** [October 20, 2021, 4:59pm UTC](https://community.localwp.com/t/local-server-vs-webpack-dev-server-static-files/28402/1 "2021-10-20T16:59:22Z")

</div>

### Issue Summary

_Webpack dev server has no access to static files on LocalWP working port (which are needed for background-image etc), but has access to these assets webpack port, for example 3000. Running without hot reload works ok, because assets are loaded from wp-content/themes/customtheme/assets/ folder_

#### Troubleshooting Questions

- Does this happen for all sites in Local, or just one in particular?  
It seems that problem occurs on all sites. For sure there is a setting problem with webpack or LocalWP.

- Are you able to create a new, plain WordPress site in Local and access it in a Browser?  
Yes. Site works well

#### Replication

1. Webpack Dev server configuration:

> ```
> if (currentTask == "devFast") {
> config.devtool = "source-map"
> cssConfig.use.unshift("style-loader")
> scssConfig.use.unshift("style-loader")
> config.output = {
> filename: "bundled.js",
> publicPath: "http://localhost:3000/",
> }
> config.devServer = {
> hot: true,
> port: 3000,
> host: "mylocaldomain.local",
> headers: {
> "Access-Control-Allow-Origin": "*",
> },
> allowedHosts: 'all',
> proxy: {
> "!/assets/**": {
> target: "http://mylocaldomain.local",
> secure: false,
> changeOrigin: true,
> },
> },
> static: [
> {
> directory: path.resolve(__dirname, '../', 'assets'),
> publicPath: '/assets',
> },
> ],
> watchFiles: ["./../ **/*.php", "./../** /*.js"],
> liveReload: false,
> historyApiFallback: true,
> }
> config.mode = "development"
> }
> 
> ```

1. Access to page from [http://mylocaldomain.local/](http://mylocaldomain.local/) (with assets error 404 from url [http://mylocaldomain.local/assets/img/cat.jpg](http://mylocaldomain.local/assets/img/cat.jpg) )  

2. Access to page from [http://mylocaldomain.local:3000](http://mylocaldomain.local:3000) (with assets success from url [http://mylocaldomain.local:3000/assets/img/cat.jpg](http://mylocaldomain.local:3000/assets/img/cat.jpg) )  

3. Access to page from [http://localhost](http://localhost)  

4. Access to page from [http://localhost:3000](http://localhost:3000) (with assets success from url [http://localhost:3000/assets/img/cat.jpg](http://localhost:3000/assets/img/cat.jpg) )  

5. It is unable to use [http://localhost:3000](http://localhost:3000) or [http://mylocaldomain.local:3000](http://mylocaldomain.local:3000), because all redirects generated by LocalWP are leading to [http://mylocaldomain.local](http://mylocaldomain.local) (without port 3000).

### System Details

- Which version of Local is being used?

- What Operating System (OS) and OS version is being used?

- Attach the Local Log. See this Community Forum post for instructions on how to do so:

### Expected results

- Ability of using static files. Maybe is there possibility to set LocalWP port on which he is working and wordpress is generating urls?

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/system/32/1_2.png) [@system](https://community.localwp.com/u/system)\
**Post date:** [January 18, 2022, 4:59pm UTC](https://community.localwp.com/t/local-server-vs-webpack-dev-server-static-files/28402/2 "2022-01-18T16:59:53Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
