javascriptparceljs

Parcel build command not working


I am following the basic tutorial for Parcel to bundle js, css and image files.

My file structure

  dist
  node_modules
  src
    - index.html
    - style.css
    - index.js
    - somemodule.js

When I run parcel ./src/index.html a server is started and the website is displayed correctly. According to the tutorial you can finalize the build using parcel build index.js. I expected to get this output:

  dist
    - style.css
    - index.js
    - index.html

But instead, after running parcel build index.js I get this output:

  dist
    - 4wyd98y98790.css
    - 948y59hslas8.js

What could possibly be going wrong?


Solution

  • The Parcel Bundler output directory is dist by default, but you can specify an output directory by setting option (-d).

    e.g.parcel build src/index.html -d build --public-url . You will get the final static files in the build directory.