dukDukz

[error] @parcel/transformer-js: Browser scripts cannot have imports or exports. 본문

웹 개발/React

[error] @parcel/transformer-js: Browser scripts cannot have imports or exports.

헤일리_HJ 2023. 3. 2. 14:58

@parcel/transformer-js: Browser scripts cannot have imports or exports.

 

parcel로 웹서버를 띄우려고 하는데 이런 오류가 났다..

 

바로바로

 

index.html

<script type='module' src="./src/main.tsx"></script>

type='module'을 안써줘서 그렇다...

 

 

index.html 전체 코드

<!DOCTYPE html>
<html lang="ko">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>react-testing-tool</title>
</head>
<body>
	<div id="root"></div>
	<script type='module' src="./src/main.tsx"></script>
</body>
</html>