While trying to bundle with parcel, i ran "npm run start" after assigning the "start" and "build" in the scripts inside the package.json but it gave an error with the following message:
Build failed.
@parcel/core: Unexpected output file type .html in target "main"
"description": "Reciepe App",
5 | "main": "index.html",
| ^^^^^^^^^^^^ File extension must be .js, .mjs, or .cjs
6 | "scripts": {
7 | "start": "parcel index.html"
name.
And when i tried removing the main and the index.html. It gives an error that "Browser scripts cannot have imports or exports."
You should remove this line "main": "index.html",
from you package.json file. NPM adds it by default to the package.json file on initial creation, and Parcel uses that "main"
field as the output path for libraries (source) which causes an error in this case because Forkify is a standalone project (not a library) with the Html file as an entry point.
To solve this error "Browser scripts cannot have imports or exports.", add type="module"
to the <script> tag in the index.html file
<script type="module" src="src/js/controller.js"></script>
This change is needed because modules in [email protected] match the behavior of native modules (non-module files can't have imports and exports) (source).
@mister-abdurahman You could deploy the app on the web ?
Owner Name | jonasschmedtmann |
Repo Name | complete-javascript-course |
Full Name | jonasschmedtmann/complete-javascript-course |
Language | JavaScript |
Created Date | 2018-06-14 |
Updated Date | 2023-03-29 |
Star Count | 12137 |
Watcher Count | 850 |
Fork Count | 14403 |
Issue Count | 153 |
Issue Title | Created Date | Updated Date |
---|