Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Write Better JavaScript With Webpack" - Content Improvements #35

Open
clschnei opened this issue Apr 8, 2018 · 1 comment
Open

"Write Better JavaScript With Webpack" - Content Improvements #35

clschnei opened this issue Apr 8, 2018 · 1 comment
Assignees

Comments

@clschnei
Copy link

clschnei commented Apr 8, 2018

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"
@dwalkr
Copy link
Contributor

dwalkr commented Apr 9, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants