Showcaselfloyd
Showcaselfloyd

Reputation: 838

Is it possible to change the root URL of Webpack-dev-server

I'm trying to use Webpack-dev-server in a project at work that involves me mimicking a certain url structure. Long story short is there a simple way to have it serve my files from http://127.0.0.1:8090/myapp rather then just http://127.0.0.1:8090

Upvotes: 3

Views: 9666

Answers (2)

Maciek
Maciek

Reputation: 71

I found an answer to this question that worked for me here.

Just use Webpack's open option like this:

module.exports = {
  // ...
  devServer: {
    open: ['/myapp'],
   // ...
  },
}

Upvotes: 0

Miguel
Miguel

Reputation: 1636

What you're looking for is the option publicPath

module.exports = {
  //...
  devServer: {
    publicPath: '/assets/'
  }
};

More info:

https://webpack.js.org/configuration/dev-server/#devserver-publicpath-

Upvotes: 4

Related Questions