Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 832
Kokodoko Avatar asked Sep 01 '26 12:09

Kokodoko


2 Answers

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.

like image 134
Masonz Avatar answered Sep 03 '26 02:09

Masonz


The tutorial may say parcel build index.js, but you should run parcel build ./src/index.html. The entry point of your app is index.html.

like image 44
c-neves Avatar answered Sep 03 '26 02:09

c-neves



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!