npm - How to use a package script under a different platform? -
i have have line package.json
"scripts": { "default_linux": "export node_env=default&& export node_minified=false&& webpack", "default_windows": "set node_env=default&& set node_minified=false&& webpack", "default_linux_min": "export node_env=default&& export node_minified=true&& webpack", "default_windows_min": "set node_env=default&& set node_minified=true&& webpack", },
but run not nice think each version separately , correctly configure scripts different platforms make team, not ..?
$ npm run default_linux # frontend assembly under linux
you can use cross-env package on npm. allows use unix style scripts, , handles cross-platform issues. works linux , windows, haven't tested mac. also, there's no need export
.
after install cross-env, can replace scripts field this:
"scripts": { "build": "cross-env node_env=default node_minified=false webpack", "build-min": "cross-env node_env=default node_minified=true webpack", },
Comments
Post a Comment