I successfully deployed my contract with the truffle console. Then I wrote my DApp with the files index.html and app.js in the /app folder.

I attempted to build my codes for production by running the command

sudo npm run build

I went into my build folder but only see /contracts. From all my previous attempts, I would have seen the production versions of index.html and app.js in this folder that I can now copy to my web server. It strange that it didn't appear this time.

I am on Truffle v4.1.14.

By the way when I run

sudo npm run dev

I could see that index.html and app.js on localhost:8080.

Any help is appreciated!

put on hold as off-topic by Ismael, shane, Richard Horrocks, Achala Dissanayake, Briomkez Dec 7 at 13:55

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about Ethereum, the decentralized application platform and smart contract enabled blockchain, within the scope defined in the help center." – Ismael, shane, Richard Horrocks, Achala Dissanayake, Briomkez
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I am using webpack by the way. – Jackson Ng Dec 6 at 3:07

My practice of deploying DApps has been to run

sudo npm run build

and then go to the /build directory to pick up the html and js files, then copy them into my /var/www/html/ directory so that I can access them externally through my webserver.

I realized that the current version of webpack obtained by running "truffle unbox webpack" no longer build the working .html and .js files in the /build directory. (WHY? It worked in July!)

Instead, the way to get your Dapp running on external IP address is as follows.

Edit webpack.config.js to add the following

devServer: {inline: true,host: '',port: 8080,},

Then execute

sudo npm run dev

This will run your DApp on a development web server at your external IP address and you will be able to access it via e.g. http://:8080.

I still do not know how I could build for production, but am happy with this temporary solution for now.

Not the answer you're looking for? Browse other questions tagged or ask your own question.