Run and Build Svelte with Parcel

Andrew Smith
InstructorAndrew Smith
Share this video with your friends

Social Share Links

Send Tweet
Published 5 years ago
Updated 3 years ago

In this lesson, you will learn how to setup the zero configuration blazing fast web application bundler Parcel with Svelte.

Instructor: [00:00] Let's start by creating a package.json file using npm init -y. Now let's install parcel, parcel-svelte, and svelte as dev dependencies.

[00:10] Inside our editor, create the index.html file inside of the root directory and create a source directory containing our main.js file. Open the index.html file and add some basic HTML structure including a script tag pointing to the main.js file.

[00:28] Let's edit the package.json file and add two entries to the script section. First, we add the command for parcel development server. Let's copy this and create the second command for the production build. Let's add another entry to our package.json file containing browsers list. This will be used by parcel when compiling.

[00:48] Now let's create the app.svelte file inside of this source directory and add some svelte code. Edit the main.js file and add the instantiation code for svelte component we just made. Open your terminal and run the parcel development server using npm start. Now open your browser and visit localhost:1234.

[01:10] Let's recap what we did. We installed parcel, svelte, and the parcel-svelte-plugin in order to compile svelte components. We set up the parcel development server and the production build command in our package.json file. Then, we created a simple svelte component to test it out.

egghead
egghead
~ 13 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today