Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
143
rated 0 times [  146] [ 3]  / answers: 1 / hits: 7120  / 2 Years ago, thu, october 20, 2022, 12:00:00

I Just created a react app. The npm start seems to work fine but npm run build is constantly failing. I need to run npm run build to deploy it on some website.


Already gone through all posts related to this on stackoverflow.com. But didn't found any working solution.


import './App.css';
import 'https://kit.fontawesome.com/a076d05399.js'

import Navbar from './components/navbar';
import Homepage from './components/homepage';
import Skills from './components/Skills';
import Project from './components/project';
import Contact from './components/contact';

Error Message


Failed to compile.

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

More From » reactjs

 Answers
1

The problem here was the import statement of an external js file.


import 'https://kit.fontawesome.com/a076d05399.js';

You can add the file in index.html & run build.


<script src="https://kit.fontawesome.com/a076d05399.js"></script>

And yes there's no problem with import statement in css.


@import url("https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css");

[#22] Wednesday, July 27, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
harveys

Total Points: 113
Total Questions: 88
Total Answers: 79

Location: Oman
Member since Fri, Dec 23, 2022
1 Year ago
;