F
F
flafy42020-06-02 23:25:39
JavaScript
flafy4, 2020-06-02 23:25:39

Why is webpack-dev-server not building code?

When you run the command, webpackeverything works correctly, the files are placed in dist.
When you run the command, the webpack-dev-serverfolder is cleared thanks to the plugin CleanWebpackPlugin, but it is not recompiled. Where can there be a mistake?

const path = require('path')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')

module.exports = {
  mode: 'development',
  entry: ['./src/index.ts'],
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist'),
    publicPath: '/dist'
  },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: 'ts-loader',
        exclude: /node_modules/
      }
    ]
  },
  resolve: {
    extensions: ['.tsx', '.ts', '.js'],
    alias: {
      '@core': path.resolve(__dirname, 'src/core')
    }
  },
  // devtool: 'source-map',
  devServer: {
    port: 3000,
    hot: true
  },
  plugins: [
    new CleanWebpackPlugin()
  ]
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
profesor08, 2020-06-03
@profesor08

Why is webpack-dev-server not building code?

Because webpack-dev-server shouldn't do that. It only raises a server for you on port 3000 for development and updates the page when the code changes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question