Tokitaka / maps-typescript

Make an application for showing a location(latitude, longitude) of user and company using TypeScript & Parcel
0 stars 0 forks source link

Parcel bundler issue #1

Open Tokitaka opened 2 months ago

Tokitaka commented 2 months ago

ES Module type=module cause 'parcelRequire is not defined' error

Tokitaka commented 2 months ago

Expected Behavior

If we write simple HTML code with ES Module like below

<html>
<body>
<script src="./index.js" type="module"></script>
</body>
</html> 
//index.ts
console.log("Hello parcel") ;

I hope it is bundled properly and get "Hello parcel" in console without error.

Current Behavior

In console,

Hello parcel
index.ts:1 Uncaught ReferenceError: parcelRequire is not defined
    at index.ts:1:24
    at index.ts:1:24

Solutions

If your script uses type="module" - remove it.