question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not build webpack.config.ts at 5.60.0 with webpack-dev-server.

See original GitHub issue

Bug report

What is the current behavior? At webpack 5.60.0, webpack.config.ts cannot be compiled and builded when property of webpack-dev-server is existed.

If the current behavior is a bug, please provide the steps to reproduce. In my webpack.config.ts, there is a property devServer because I use webpack-dev-server. like:

import webpack from "webpack"
import type { Configuration } from "webpack-dev-server"

const devServer: Configuration = {
  static: {
    directory: path.resolve(__dirname, "/dist"),
  },
  historyApiFallback: true,
  open: true,
  port: 8000,
  hot: true,
  proxy: {
    "/api": "http://localhost:8080",
  },
}

const config: webpack.Configuration = {
  // Omit lines //

  devServer: devServer,
}

When I upgraded webpack from 5.59.1 to 5.60.0, tsc errors on the property that shows:

Object literal may only specify known properties, and 'devServer' does not exist in type 'Configuration'.

What is the expected behavior? At webpack 5.59.1, webpack.config.ts is correctly builded, but at webpack 5.60.0 is not.

Other relevant information: webpack version: 5.60.0 Node.js version: v14.18.1 Operating System: any Additional tools: webpack-dev-server@4.3.1, @types/webpack-dev-server@4.3.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
alexander-akaitcommented, Oct 26, 2021

Don’t worry, all is fine

0reactions
KashEightcommented, Oct 26, 2021

I recognized this error was occurred by yarn’s cache when I make reproducible example. So, after I do yarn cache clean, the error was solved. This is all of my fault, sorry for taking time for me…

Edit: error was caused by yarn.lock. Removing and Regenerating it solved this error completely.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration error in webpack-dev-server v4 2022
Dev Server has been initialized using an options object that does not match the API schema. - options has an unknown property 'contentBase'....
Read more >
Configuration Languages - webpack
If the module in compilerOptions in tsconfig.json is commonjs , the setting is complete, else webpack will fail with an error. This occurs...
Read more >
@angular-builders/custom-webpack - npm
This option defines your custom webpack configuration. If not specified at all, plain Angular build will run.
Read more >
How I solved and debugged my Webpack issue through trial ...
Debugging webpack config is usually a cumbersome task: the best way to go about it is to create a config from a scratch....
Read more >
Using webpack with TypeScript - LogRocket Blog
Learn how to use webpack to compile TypeScript to JavaScript and bundle source ... By default, webpack does not need a configuration file....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found