How to use webpack 5 without Angular

SafeValue must use [property]=binding: So, we understood that webpack 5 is a powerful tool for building modules into a single file. Since Angular 11, we used the Angular CLI framework to create an Angular application. But the point is that Angular CLI uses webpack. It follows from this that we can use webpack 5 without Angular at all. Notice, we'll use webpack 5 exactly, which is slightly different from previous versions. (see http://g.co/ng/security#xss)
“In the beginning was the new project...”
SafeValue must use [property]=binding: Let's define a new package.json file in the new project we created to use webpack 5: In general, we believe everything is clear except for the following sections: devDependencies to keep the definition of the typescript, webpack, and webpack-dev-server packages and a bunch of packages that are mainly intended for loading certain types of files. Scripts section to define dev command to launch the test web server webpack-dev-server, which in turn will launch the application, and build command to compile all required assemblies from disparate modules. Then we will add the tsconfig.json file to the project folder to manage the typescript configuration:
To install all dependencies, let's run the terminal, and in the project's folder will execute npm install. So it's time to create the files of the application. We make the index.html in the src folder, which we will place in the project folder. Here it is: In the next step, we need to create a polyfill to support all standard browsers. It will be the polyfills.ts file in the src folder.Then it's time to create components. We created an app folder in the src folder, and finally, there we create app.component.ts. Let's add a module file app.module.ts in the same folder. The file main.ts is also needed to insert in the src folder. Thus, we have created all the files which are needed for the standard Angular project. It remains to add a file webpack.config.js into the root folder with a configuration of webpack 5 and the project is almost complete. (see http://g.co/ng/security#xss)
Let's launch this project
SafeValue must use [property]=binding: The finished project will look like this: To start this project, let's go into the project's root folder using terminal and run npm run dev which is defined in package.json. By default, webpack-dev-server launches the project and accesses it in the browser: Then the compiled application files that are required to work will be placed in a dist folder which will appear in the project, and we'll place them on some web server and refer to the index.html file. (see http://g.co/ng/security#xss)