V
V
vetsmen2018-02-15 17:39:27
Node.js
vetsmen, 2018-02-15 17:39:27

How to give assets through webpack to a specific directory?

My webpack is configured like this:

output: {
    path: path.resolve(__dirname, './src/assets'),
    publicPath: '/',
    filename: 'build.js'
  },
  devServer: {
    host: 'test.ru',
    historyApiFallback: true,
    noInfo: true,
    overlay: true,
    openPage: ''
  }

I receive a message:
Project is running at http://test.ru:80/
webpack output is served from /
404s will fallback to /index.html

I tried to change publicPath to /src/assets, I even changed output.path to something else, but my assets are always in the test.ru/src/assets/* path, and I need test.ru/*
What I do not this way?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Epifanov, 2018-02-16
@vetsmen

need to be configured output.path
, for example, with this value , all files will be in the dist folder, which is located next to webpack.config.js The web server distributes files already from this folder path: path.join(__dirname, './dist')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question