Cannot get the stats.json from the classpath META-INF/VAADIN/config/stats.j

I am using vaadin flow 14.1.25 along with JavaEE 8 and wildfly 2018. I do run it in production mode.
When I run the application, JavaEE part of the application works fine but when I navigate to vaadin view getting following error:

Cannot get the 'stats.json' from the classpath 'META-INF/VAADIN/config/stats.json'

After searching on the internet I get a tip which said I should run node node_modules\webpack\bin\webpack.js in the root of my application and I did it but again getting another error as below:

C:\Development\workspace\soft\counting-web>node node_modules\webpack\bin\webpack.js
i 「atl」: Using typescript@3.7.3 from typescript
i 「atl」: Using tsconfig.json from C:/Development/workspace/soft/counting-web/tsconfig.json
i 「atl」: Checking started in a separate process...
× 「atl」: Checking finished with 2 errors
Hash: fa7e89b7006d4e70abbe
Version: webpack 4.42.0
Time: 3332ms
Built at: 2020-05-07 8:53:28
Entrypoint bundle =
[0]
 ../target/index.ts + 1 modules 92.2 KiB {0} [built]

    | ../target/index.ts 1.46 KiB [built]

    |     + 1 hidden module

ERROR in ../target/index.ts
Module not found: Error: Can't resolve '../target/frontend/generated-flow-imports' in 'C:\Development\workspace\soft\counting-web\target'
 @ ../target/index.ts 17:19-70

ERROR in ../target/index.ts
Module not found: Error: Can't resolve '@vaadin/flow-frontend/Flow' in 'C:\Development\workspace\soft\counting-web\target'
 @ ../target/index.ts 15:0-50 16:33-37

ERROR in chunk bundle [entry]

build/vaadin-bundle-a427b921febfb9ca0ea2.cache.js
C:\Development\workspace\soft\counting-web\node_modules\awesome-typescript-loader\dist\entry.js!C:\Development\workspace\soft\counting-web\target\index.ts 052da964a93a474bf00dd0019aa9cf65
Unexpected token (17:33)
| // import Flow module to enable navigation to Vaadin server-side views
| 
| const { serverSideRoutes } = new !(function webpackMissingModule() { var e = new Error("Cannot find module '@vaadin/flow-frontend/Flow'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())({
|     imports: () => Promise.resolve().then(function webpackMissingModule() { var e = new Error("Cannot find module '../target/frontend/generated-flow-imports'"); e.code = 'MODULE_NOT_FOUND'; throw e; })
| });

ERROR in [at-loader]
 ./target/index.ts:18:20 
    TS2307: Cannot find module '@vaadin/flow-frontend/Flow'.

ERROR in [at-loader]
 ./target/index.ts:21:25 
    TS2307: Cannot find module '../target/frontend/generated-flow-imports'.
Child html-webpack-plugin for "index.html":
     1 asset
    Entrypoint undefined = index.html
    [0]
 ../node_modules/html-webpack-plugin/lib/loader.js!../target/index.html 1.08 KiB {0} [built]

        + 3 hidden modules

pom.xml

<build>
	<pluginManagement>
		<plugins>
			<plugin>
        		<groupId>org.apache.maven.plugins</groupId>
        		<artifactId>maven-help-plugin</artifactId>
        		<version>3.2.0</version>
				<executions>
					<execution>
						<id>show-profiles</id>
						<phase>compile</phase>
						<goals>
							<goal>active-profiles</goal>
						</goals>
					</execution>
				</executions>
      		</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>${maven-compiler-plugin-version}</version>
			</plugin>
			<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<version>3.2.2</version>
				<configuration>
					<packagingExcludes>
						WEB-INF/lib/xmlParserAPIs-2.0.2.jar,
						WEB-INF/lib/xml-apis-1.3.02.jar,
						WEB-INF/lib/xml-apis-1.0.b2.jar,
						WEB-INF/lib/pdf-renderer-1.0.5.jar,
						WEB-INF/lib/oro-2.0.8.jar,
						WEB-INF/lib/jstl-1.2.jar,
						WEB-INF/lib/jfreechart-1.0.1.jar,
						WEB-INF/lib/jempbox-1.6.0.jar,
						WEB-INF/lib/jdtcore-3.2.0.v_658.jar,
						WEB-INF/lib/jcommon-1.0.16.jar,
						WEB-INF/lib/informix-driver-3.0.jar,

						WEB-INF/lib/commons-validator-1.3.1.jar,
						WEB-INF/lib/commons-lang-2.4.jar,
						WEB-INF/lib/commons-io-1.3.2.jar,
						WEB-INF/lib/commons-codec-1.3.jar,
						WEB-INF/lib/bcmail-jdk14-1.38.jar,
						WEB-INF/lib/bcprov-jdk14-1.38.jar,
						WEB-INF/lib/bctsp-jdk14-1.38.jar,
						WEB-INF/lib/bcprov-jdk16-1.45.jar,
						WEB-INF/lib/batik-util-1.6-1.jar,
						WEB-INF/lib/batik-gui-util-1.6-1.jar,
						WEB-INF/lib/batik-ext-1.6-1.jar,
						WEB-INF/lib/batik-awt-util-1.6-1.jar,

						WEB-INF/lib/slf4j-api-1.6.1.jar,
						WEB-INF/lib/slf4j-log4j12-1.6.1.jar

						WEB-INF/lib/junit-3.8.1.jar

					</packagingExcludes>
				</configuration>
			</plugin>
		</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>com.vaadin</groupId>
				<artifactId>vaadin-maven-plugin</artifactId>
				<version>${vaadin.version}</version>
				<executions>
					<execution>
						<goals>
							<goal>prepare-frontend</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>

	</build>
	<profiles>
		<profile>
			<id>production</id>
			<properties>
				<vaadin.productionMode>true</vaadin.productionMode>
			</properties>

			<dependencies>
				<dependency>
					<groupId>com.vaadin</groupId>
					<artifactId>flow-server-production-mode</artifactId>
				</dependency>
			</dependencies>

			<build>
				<plugins>
					<plugin>
						<groupId>com.vaadin</groupId>
						<artifactId>vaadin-maven-plugin</artifactId>
						<executions>
							<execution>
								<goals>
									<goal>prepare-frontend</goal>
									<goal>build-frontend</goal>
								</goals>
								<phase>compile</phase>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

My questions regarding this issue, if any genius one can answer it. thanks in advance.

  1. Why does this happen?
  2. What is the best solution to prevent it?
  3. Is there any solution to applay in the maven pom to resolve this issue?