arnirjhor / webpack-boilerplate

A basic webpack boilerplate for beginners to start with any project
MIT License
62 stars 31 forks source link

Simplify Scripts #3

Closed Crisfole closed 1 year ago

Crisfole commented 6 years ago

scripts default to the .bin folder in node_modules before global installs. You can test this by:

npm uninstall -g webpack
npm run build
# Reinstall here if you want.

This is important because it means one less binary installed on your PATH. (YAY!)

arnirjhor commented 6 years ago

Hey @Crisfole thank you for the pull request. I intentionally use the local package installs for every project. It make my brain cool to see every dependencies in it's own container :grinning: . And the thing is this repo is being used as the reference of the article I wrote about webpack starter guide. And there I mentioned the reason of this setup. I think, I might not want to change this section since this repo is being used by the developers entering the webpack world recently. But thanks for the catch. Have a good day!

Crisfole commented 6 years ago

@postNirjhor Yeah! I'm totally on board with using local package installs. Just webpack does use the local package install. I don't have any global npm packages installed except npm itself, but using webpack in scripts still works becuase it's installed in node_modules. (Good example: https://stackoverflow.com/a/49222220/456188)

Crisfole commented 6 years ago

Here. Better example 😀

cd ~
mkdir crisfoles_example
cd crisfoles_example
npm init -y
 # Install an npm package you *don't* have installed globally here that includes a binary in `.bin`
npm install -D rollup
# MANUAL STEP: Add `"rollup": "rollup -v"` to the scripts.
npm run rollup

It still works, because it targets your local bin folder

arnirjhor commented 6 years ago

Good catch!

Crisfole commented 6 years ago

Your article is fantastic, just wanted to simplify for new users!

arnirjhor commented 6 years ago

Thank you so much @Crisfole ! I'll add your suggestion on the next update while I'll migrate that article from webpack 3 to 4. I'll definitely add your suggestion. And I'm so glad that you liked it. :)

Crisfole commented 1 year ago

I'm clearing out my open PRs. Closing this. The branch still exists, obvoiusly.