WepPackDevServer

Part of webpack. Needed for hot reload, also can serve requested files.

configure in webpack.config

    devServer: {
        port: 3003,
        static: {
            directory: path.join(__dirname, 'out'),
            publicPath: `/path/${APP_VERSION}/`,
        },
    },

Start it like this

npx webpack serve --config webpack.config.ts --mode production

after start it will show smth like

<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:3003/
<i> [webpack-dev-server] On Your Network (IPv4): http://10.6.14.56:3003/
<i> [webpack-dev-server] Content not from webpack is served from 

How to define which files it can serve ?

http://localhost:3003/webpack-dev-server

After showing, click any of them and you will see the adress, so you can pick any of them.

For example you can add this way a source map

http://localhost:3003/path/sourceMaps/js/main.js.map
This entry was posted in Без рубрики. Bookmark the permalink.