I am using webpack-dev-server locally to build my application. I have configure it properly and on running command "yarn build" its generating files into /dist/ folder.
Is there any way I can use the dist folder locally using the webpack-dev-server? The idea is I need to run multiple versions of my application locally to test few stuf.
To run the local installation of webpack you can access its binary version as node_modules/. bin/webpack . Alternatively, if you are using npm v5. 2.0 or greater, you can run npx webpack to do it.
Webpack v4+ will minify your code by default in production mode . Note that while the TerserPlugin is a great place to start for minification and being used by default, there are other options out there: ClosureWebpackPlugin.
You need a server to serve your generated dist folder.
You can use (https://www.npmjs.com/package/http-server):
npm install -g http-server
Jump into your dist folder and run:
http-server
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With