If I try routing before ejecting the webpack, it works as expected. As soon as you do ng eject, the application does compiles and runs, but router does not work. The first call is routed properly, but if you try to refresh or navigate to other route, the application returns CANNOT /GET route.
Any suggestions?
It's related to the webpack dev server configuration. It needs to be using fallback option like we do on https://github.com/angular/angular-cli/blob/master/packages/@angular/cli/tasks/serve.ts#L138-L142 but the npm start script on eject doesn't take that into account.
I also noticed "ng eject" does not include "webpack" as a devDependency in package.json.
~npm build and ~yarn build fail since "webpack" cannot be resolved.
Build command found in package.json's scripts
"build": "webpack",
Struggling with the same problem, but found a solution on a similar problem with React. Add the following configuration to your webpack.config.js
"devServer": {
"historyApiFallback": true
},
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Struggling with the same problem, but found a solution on a similar problem with React. Add the following configuration to your
webpack.config.js