forestry.io
forestry.io copied to clipboard
"Write Better JavaScript With Webpack" - Content Improvements
Just wanted to discuss some possible content changes to a recent blog post:
1. AMD
Webpack supports two standards for Module configuration: EcmaScript and CommonJS.
Even if it's unfashionable these days, webpack does support AMD module syntax. I think there is some value in including a brief example and explanation.
2. npm
scripts
{ "name": "my-webpack-demo", ... "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "build": "./node_modules/webpack-cli/bin/webpack.js", "watch": "./node_modules/webpack-cli/bin/webpack.js --watch" }, ... }
A major advantage to using npm
scripts is that we can use the namespace given to the cli tools, even if they're installed locally. Because when evaluating scripts, npm
adds node_modules/.bin/
to the PATH
environment variable. To highlight best practice, we can improve that snippet to read:
"build": "webpack",
"watch": "webpack --watch"
Thanks for your feedback! I agree that these are worth mentioning - I will provide an update to the article along with PR #34 which addresses your second point.