'How to fix my webpack error during project build?

When I try to build my React project, Webpack gives me this error :

The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script

I read what it could be connected with, and I realized that in my project there are many imports of the following type:

import { onAuthStateChanged, createUserWithEmailAndPassword, signInWithEmailAndPassword, signOut } from "https://www.gstatic.com/firebasejs/9.6.0/firebase-auth.js";

That is, the import comes from an external source, not locally. As far as I understand the problem is this.

I have no way to change such imports to be suitable for the assembly. How it is possible to bypass this problem?

Git repo : link



Solution 1:[1]

Add this to your package.json file

"type": "module"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Erfan HosseinPoor