npm-watch runs only once - node.js

I tried to use npm-watch as file watcher to compile scss files. As I run npm run watch, the script runs and does what I expected. But after the run, it immediately ends and does not run again on file change. In other words, it works but it does not watching. It only runs once. What could be the problem?
This is package.json
{
"name": "limitless",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"autoprefixer": "^10.2.5"
},
"devDependencies": {
"jshint": "^2.10.3",
"node": "14.16.0",
"node-sass": "^5.0.0",
"npm-watch": "^0.11.0",
"uglify-js": "^3.16.1",
"uglifycss": "^0.0.29"
},
"watch": {
"patterns": ["www/scss"],
"extensions": ["scss"],
"delay": "2000"
},
"scripts": {
"watch": "node-sass www/scss/theme.scss www/css/theme.css"
}
}

The problem was that called npm run watch insted of npm-watch.
The solution looks like this:
"watch": {
"compile-css": {
"patterns": ["www/scss"],
"extensions": ["scss"],
"delay": 250,
"runOnChangeOnly": true
},
"compile-js": {
"patterns": ["www/js/src"],
"extensions": ["js"],
"delay": 250,
"runOnChangeOnly": true
}
},
"scripts": {
"compile-css": "npm run scss && npm run minify-css",
"compile-js": "uglifyjs www/js/src/app.js -o www/js/dist/app.min.js & uglifyjs www/js/src/main.js -o www/js/dist/main.min.js",
"scss": "node-sass www/scss/theme.scss www/css/theme.css",
"minify-css": "css-minify -f www/css/theme.css -o www/css",
"js": "npm run uglifyjs ",
"watch": "npm-watch"
},
and so I run npm run watch which calls npm-watch which triggers other scripts if files has been changed.

Related

React import problem, 'Module not found: Can't resolve' while import package wechaty

I'm new to nodejs and react. In my project, I use a package "wechaty". And it works fine when my project is a pure nodejs.
Then when I try to integrate "wechaty" with react, it failed to compile and report errors.
// Code in App.js
import { WechatyBuilder, ScanStatus, log} from "wechaty"
When I run npm start/yarn start, the error message appears
Failed to compile.
./src/App.js Module not found: Can't resolve 'wechaty' in
'D:\git\chat-client\src'
I guess it may be because there is no 'module' field in the package.json of 'wechaty', so I add that field.
"module": "./dist/esm/src/mods/mod.js",
The exact problem do disappeared. But it still cannot resolve sub modules.
Failed to compile.
./node_modules/wechaty/dist/esm/src/mods/mod.js Module not found:
Can't resolve 'wechaty-puppet/helpers' in
'D:\git\chat-client\node_modules\wechaty\dist\esm\src\mods'
Compiling... Failed to compile.
Even worse is that 'wechaty' has many dependence packages, and all the dependence packages have the same problem.
Here follows the package.json of 'wechaty':
{
"name": "wechaty",
"version": "1.0.6",
"description": "Wechaty is a RPA SDK for Chatbot Makers.",
"type": "module",
"exports": {
".": {
"import": "./dist/esm/src/mods/mod.js",
"require": "./dist/cjs/src/mods/mod.js"
},
"./impls": {
"import": "./dist/esm/src/mods/impls.js",
"require": "./dist/cjs/src/mods/impls.js"
},
"./users": {
"import": "./dist/esm/src/mods/users.js",
"require": "./dist/cjs/src/mods/uses.js"
}
},
"typesVersions": {
"*": {
"users": [
"./dist/esm/src/mods/users.d.ts"
],
"impls": [
"./dist/esm/src/mods/impls.d.ts"
]
}
},
"types": "./dist/esm/src/mods/mod.d.ts",
"engines": {
"node": ">=16",
"npm": ">=7"
},
"wechaty": {
"DEFAULT_PORT": 8080,
"DEFAULT_PROTOCOL": "io|0.0.1",
"DEFAULT_APIHOST": "api.chatie.io"
},
"scripts": {
"build": "tsc && tsc -p tsconfig.cjs.json",
"changelog": "docker run -it --rm -e CHANGELOG_GITHUB_TOKEN -v \"$(pwd)\":/usr/local/src/your-app ferrarimarco/github-changelog-generator -u wechaty -p wechaty && sed -i'.bak' /greenkeeper/d CHANGELOG.md && sed -i'.bak' /Snyk/d CHANGELOG.md && sed -i'.bak' '/An in-range update of/d' CHANGELOG.md && node --no-warnings --loader=ts-node/esm scripts/sort-contributiveness.ts < CHANGELOG.md > CHANGELOG.new.md 2>/dev/null && cat CHANGELOG.md >> CHANGELOG.new.md && mv CHANGELOG.new.md CHANGELOG.md",
"check-node-version": "check-node-version --node \">= 16\"",
"clean": "shx rm -fr dist/*",
"coverage": "nyc report --reporter=lcov",
"demo": "cross-env NODE_OPTIONS=\"--no-warnings --loader=ts-node/esm\" node examples/ding-dong-bot.ts",
"dist": "npm-run-all clean build dist:commonjs",
"dist:commonjs": "jq -n \"{ type: \\\"commonjs\\\" }\" > dist/cjs/package.json",
"docs": "bash -x scripts/generate-docs.sh",
"doctor": "npm run check-node-version && node --no-warnings --loader=ts-node/esm bin/doctor.ts",
"io-client": "node --no-warnings --loader=ts-node/esm bin/io-client.ts",
"lint:es": "eslint --ignore-pattern node_modules/ --ignore-pattern fixtures/ \"{bin,examples,src,scripts,tests}/**/*.ts\"",
"lint:md": "markdownlint README.md",
"lint:sh": "bash -n bin/*.sh",
"lint:ts": "tsc --isolatedModules --noEmit",
"lint": "npm-run-all check-node-version lint:es lint:ts lint:sh lint:md",
"puppet-install": "node --no-warnings --loader=ts-node/esm bin/puppet-install.ts",
"sloc": "sloc bin examples scripts src tests --details --format cli-table --keys total,source,comment && sloc bin examples scripts src tests",
"start": "npm run demo",
"test:pack": "bash -x scripts/npm-pack-testing.sh",
"test:shell": "shellcheck bin/*.sh scripts/*.sh",
"test:unit": "cross-env NODE_OPTIONS=\"--no-warnings --loader=ts-node/esm\" TAP_TIMEOUT=60 tap \"src/**/*.spec.ts\" \"tests/**/*.spec.ts\"",
"test": "npm run lint && nyc npm run test:unit && npm run sloc",
"typedoc": "bash scripts/typedoc.sh"
},
"repository": {
"type": "git",
"url": "git+https://github.com/wechaty/wechaty.git"
},
"bin": {
"wechaty-doctor": "dist/esm/bin/doctor.js",
"wechaty-io-client": "dist/esm/bin/io-client.js",
"wechaty-puppet-install": "dist/esm/bin/puppet-install.js",
"wechaty-version": "dist/esm/bin/version.js"
},
"keywords": [
"ai",
"bot",
"chatbot",
"chatie",
"conversational",
"framework",
"robot",
"rpa",
"sdk",
"wechat",
"wecom",
"wxwork",
"lark",
"TikTok",
"weixin",
"whatsapp",
"微信"
],
"author": {
"name": "Huan LI (李卓桓)",
"email": "zixia#zixia.net",
"url": "https://linkedin.com/in/zixia/"
},
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/wechaty/wechaty/issues"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/wechaty"
},
"homepage": "https://github.com/wechaty/",
"dependencies": {
"clone-class": "^1.0.2",
"cockatiel": "^2.0.2",
"dotenv": "^10.0.0",
"json-rpc-peer": "^0.17.0",
"open-graph": "^0.2.6",
"state-switch": "^1.1.15",
"uuid": "^8.3.2",
"wechaty-puppet": "^1.0.1",
"wechaty-puppet-service": "^1.0.1",
"ws": "^8.2.3"
},
"devDependencies": {
"#chatie/eslint-config": "^1.0.3",
"#chatie/git-scripts": "^0.6.2",
"#chatie/semver": "^0.4.7",
"#chatie/tsconfig": "^1.0.2",
"#types/dotenv": "^8.2.0",
"#types/glob": "^7.2.0",
"#types/open-graph": "^0.2.2",
"#types/raven": "^2.5.4",
"#types/uuid": "^8.3.1",
"#types/ws": "^8.2.0",
"check-node-version": "^4.1.0",
"coveralls": "^3.1.1",
"glob": "^7.2.0",
"jsdoc-to-markdown": "^7.1.0",
"nyc": "^15.1.0",
"qrcode-terminal": "^0.12.0",
"raven": "^2.6.4",
"sloc": "^0.2.1",
"typed-emitter": "^1.4.0",
"typedoc": "^1.0.0-dev.4 ",
"wechaty-puppet-mock": "^1.0.1",
"wechaty-puppet-padlocal": "^0.4.2"
},
"files": [
"bin/",
"dist/",
"src/"
],
"publishConfig": {
"access": "public",
"tag": "latest"
},
"collective": {
"type": "opencollective",
"url": "https://opencollective.com/wechaty"
},
"git": {
"scripts": {
"pre-push": "npx git-scripts-pre-push"
}
}
}
Here follows the ./dist/esm/src/mods/mod.js
export { WechatyBuilder, } from '../wechaty-builder.js';
export * as type from 'wechaty-puppet/types';
export * as payload from 'wechaty-puppet/payloads';
export * as helper from 'wechaty-puppet/helpers';
export * as impl from './impls.js';
export * as user from './users.js';
export * from './users.js';
export { ScanStatus, } from 'wechaty-puppet/types';
export { log, config, qrcodeValueToImageUrl, VERSION, } from '../config.js';
export { IoClient, } from '../io-client.js';
//# sourceMappingURL=mod.js.map
Here follows package.js of my own project:
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.11.4",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"socket.io-client": "^4.4.0",
"web-vitals": "^1.0.1",
"wechaty": "^1.0.6"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

When trying to publish the extension, receive error: Part URI is not valid per rules defined in the Open Packaging Conventions specification

I'm trying to publish an extension by vsce, I logged in with the user access token,
after the build its create a file named 'NadavShaked.my-first-extension v1.0.968.vsix'
I'm trying to publish the extension to the marketplace by this command 'vsce publish' and received this error:
this is the guide I used
https://code.visualstudio.com/api/working-with-extensions/publishing-extension
this is my azure-devops-extension.json file:
{
"manifestVersion": 1,
"id": "my-first-extension",
"publisher": "NadavShaked",
"version": "1.0.968",
"name": "my-first-extension",
"description": "Azure DevOps Extension",
"categories": [
"Azure Repos",
"Azure Boards",
"Azure Pipelines",
"Azure Test Plans",
"Azure Artifacts"
],
"targets": [ {
"id": "Microsoft.VisualStudio.Services"
} ],
"icons": {
"default": "logo.png"
},
"content": {
"details": {
"path": "overview.md"
}
},
"files": [ {
"path": "dist",
"addressable": true
} ]
}
this is my package.json file:
{
"id": "my-first-extension",
"name": "my-first-extension",
"publisher": "NadavShaked",
"version": "1.0.968",
"description": "Azure DevOps Extension",
"keywords": [
"extensions",
"Azure DevOps",
"Visual Studio Team Services"
],
"engines": {
"vscode": "^1.8.0"
},
"license": "MIT",
"repository": {
"type": "git",
"url": ""
},
"scripts": {
"clean": "rimraf ./dist",
"compile": "npm run clean && npm run test && webpack --mode production",
"compile:dev": "npm run clean && npm run test && webpack --mode development",
"build": "npm run compile",
"build:dev": "npm run compile:dev && npm run postbuild",
"postbuild": "npm run package-extension -- --rev-version",
"package-extension": "tfx extension create --manifest-globs azure-devops-extension.json src/Samples/**/*.json",
"publish-extension": "tfx extension publish --manifest-globs azure-devops-extension.json src/Samples/**/*.json",
"test": "set TEST_REPORT_FILENAME=test-results.xml && jest --verbose"
},
"dependencies": {
"#fluentui/react": "^8.36.3",
"azure-devops-extension-api": "~1.157.0",
"azure-devops-extension-sdk": "~2.0.11",
"azure-devops-ui": "~2.164.0",
"react": "~16.13.1",
"react-dom": "~16.13.1"
},
"devDependencies": {
"#testing-library/jest-dom": "^5.11.0",
"#testing-library/react": "^10.4.4",
"#types/jest": "^26.0.3",
"#types/react": "~16.8.2",
"#types/react-dom": "~16.8.0",
"copy-webpack-plugin": "^7.0.0",
"base64-inline-loader": "~1.1.1",
"css-loader": "~1.0.0",
"jest": "^26.1.0",
"jest-junit-reporter": "^1.1.0",
"node-sass": "^5.0.0",
"rimraf": "~2.6.2",
"sass-loader": "~10.0.5",
"style-loader": "~0.23.1",
"tfx-cli": "^0.6.3",
"ts-jest": "^26.1.1",
"ts-loader": "~5.2.2",
"typescript": "^3.9.6",
"webpack": "^5.23.0",
"webpack-cli": "^4.5.0"
},
"jest": {
"transform": {
"^.+\\.(js|ts|tsx|jsx)$": "ts-jest"
},
"transformIgnorePatterns": [
"node_modules/(?!(react-native|azure-devops-ui|azure-devops-extension-sdk)/)"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/__mocks__/fileMock.js",
"\\.(css|less|scss)$": "<rootDir>/src/__mocks__/styleMock.js"
},
"preset": "ts-jest/presets/js-with-babel",
"testResultsProcessor": "./node_modules/jest-junit-reporter",
"collectCoverage": true,
"coverageReporters": [
"json",
"html",
"cobertura"
],
"globals": {
"ts-jest": {
"tsconfig": "tsconfig.test.json"
}
}
}
}
I upload the project to git my repo:
https://github.com/NadavShaked/vstsExtension/tree/master/vsts%20extension
this is the extension by run: 'vsce package'
https://easyupload.io/skwmep
this is the extension by run: 'npm run build'
https://easyupload.io/kzopux
I prefer to publish the second extension (npm run build command)
vsce is not the right command to publish to Azure devops.
In my package.json, I used npm run publish-extension or better npm run package-extension and published it by hand.

Disallow node app from accessing global npm modules, or at least warn?

Is there any way to either (a) disallow a node application from require/importing globally-installed npm modules, or (b) at least output a warning when a globally-installed module is used?
Reason being: I've repeatedly wound up in situations where a developer (myself included) incorporates a module in a node application but fails to add it to package.json because it happens to be globally installed on their machine, and therefore there's no error on the local machine; but upon deployment to a system that doesn't have that module installed globally, of course, it fails. Would be convenient to just ensure that all modules are in fact included in package.json.
ESLint Way
1) use husky module: npm install husky --save-dev
2) install eslint and it's deps (see package.json example below).
3) example package.json:
{
"name": "shopping-cart-estimator-test",
"version": "1.0.0",
"description": "",
"scripts": {
"start": "node ports/http.js",
"eslint-check": "./node_modules/eslint/bin/eslint.js .",
"eslint-fix": "./node_modules/eslint/bin/eslint.js . --fix",
"test": "./node_modules/.bin/mocha test --exit"
},
"devDependencies": {
"babel-eslint": "^10.1.0",
"husky": "^4.2.5",
"mocha": "^7.1.2",
"eslint": "^7.0.0",
"eslint-config-import": "^0.13.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1"
},
"dependencies": {
"lodash": "^4.17.15"
},
"husky": {
"hooks": {
"pre-commit": "npm run eslint-check && npm test",
"pre-push": "npm run eslint-check && npm test"
}
}
}
4) create .eslintrc.js file with import/no-extraneous-dependencies rule (it requires eslint-plugin-import, make sure it's in package.json):
module.exports = {
"extends": "standard",
"parser": "babel-eslint",
"rules": {
"semi": ["error", "always"],
"no-unused-vars": 1,
"spaced-comment": ["warn"],
"no-trailing-spaces": ["warn"],
"comma-dangle": ["error", {
"arrays": "always",
"objects": "always",
"imports": "never",
"exports": "never",
"functions": "never"
}],
"space-before-function-paren": ["error", {
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}],
"import/no-extraneous-dependencies": ["error", {"packageDir": __dirname}],
},
"overrides": [{
"files": ["spec/tests/*.js", "spec/tests/**/*.js"],
"rules": {
"no-unused-expressions": 0,
"no-unused-vars": 1
}
}]
};
"Custom Script way"
1) use husky module: npm install husky --save-dev
2) add hook to pre-commit, pre-push in package.json:
"husky": {
"hooks": {
"pre-commit": "npm test && node scripts/check-deps.js",
"pre-push": "npm test && node scripts/check-deps.js"
}
}
3) install dependency-tree: npm i --save dependency-tree
4) write scripts/check-deps.js script that will find external (non package.json) dependencies and if they exist will:
console.warn('Found external dependency');
process.exit(-1);

How to configure ESlint to work both Mac and WIndows machines

I have a Nodejs project which uses ESLint to keep consistency.
On my Mac machine, I have no troubles all works bur on Windows I got this error
No files matching the pattern "'./*'" were found.
Please check for typing mistakes in the pattern.
My setup for ESLint is
{
"env": {
"es6": true,
"node": true
},
"extends": [
"plugin:prettier/recommended",
"airbnb-base"
],
"plugins": [
"prettier"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"prettier/prettier": "error",
"linebreak-style": "off"
}
}
Package.json
{
"name": "new-architecture-solution",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prod": "node -r esm server.js",
"dev": "nodemon -r esm server.js",
"debug": "ndb nodemon -r esm server.js",
"lint": "eslint . --ext .js,.jsx --quiet",
"fix": "eslint './*' --fix",
"prettier": "prettier --write src/**/*.{js,css}"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"eslintIgnore": [
"package.json",
"package-lock.json",
"combined.log",
"swagger.json",
"README.md"
],
"lint-staged": {
"./**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
"npm run prettier",
"npm run lint --color",
"npm run fix",
"git add"
]
},
I'm unable to find asolution and I would like to have it work in both my machines
I haven't tried it yet on Windows, but according to this post replacing the single quotes with \" might do the trick. I've tried it on my Mac and it seems to work properly.
Edit: confirmed to work on Windows machines as well.

Git Bash and webpack

Hello guys I'm trying to learn Webpack I've been following some tutorials and I've run into some problems. I've installed webpack locally in folder I am working in with npm install webpack --save-dev. I made two JS scripts and I wanted to bundle them and I've tried following command webpack script-1.js /.bundle.js in WindowsPowerShell (I'm using Windows 7). Now this made the following error
webpack is not recognized as an internal or external command operable program or batch file
So then I installed webpack globally, and when I used the same command in PowerShell (I have opened it as an admin), it made bundle.js file but not in the directory I was working in, but in C:
Now after this failure I've decided to try using git bash. First I've tried this command webpack script-1.js /.bundle.js and got the following error
bash: webpack: command not found
Finally after some trying I was able to make it work using this command in git bash node_modules/.bin/webpack ./script-1.js bundle.js
Is there a way to fix this, so I can just type webpack instead of whole path ? Also is there a way to fix path in PowerShell ?
This is mine package.json
{
"name": "webpack-playlist",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/iamshaunjp/webpack-playlist.git"
},
"author": "me",
"license": "MIT",
"bugs": {
"url": "https://github.com/iamshaunjp/webpack-playlist/issues"
},
"homepage": "https://github.com/iamshaunjp/webpack-playlist#readme",
"devDependencies": {
"webpack": "^2.3.3"
}
}
and this is package.json located in node_modules/webpack/package.json
{
"_args": [
[
{
"raw": "webpack",
"scope": null,
"escapedName": "webpack",
"name": "webpack",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"C:\\Users\\Djole\\Desktop\\NetNinja\\webpack-playlist"
]
],
"_from": "webpack#latest",
"_id": "webpack#2.3.3",
"_inCache": true,
"_location": "/webpack",
"_nodeVersion": "7.4.0",
"_npmOperationalInternal": {
"host": "packages-12-west.internal.npmjs.com",
"tmp": "tmp/webpack-2.3.3.tgz_1491205859622_0.6350918470416218"
},
"_npmUser": {
"name": "sokra",
"email": "tobias.koppers#googlemail.com"
},
"_npmVersion": "4.0.5",
"_phantomChildren": {},
"_requested": {
"raw": "webpack",
"scope": null,
"escapedName": "webpack",
"name": "webpack",
"rawSpec": "",
"spec": "latest",
"type": "tag"
},
"_requiredBy": [
"#DEV:/",
"#USER"
],
"_resolved": "https://registry.npmjs.org/webpack/-/webpack-2.3.3.tgz",
"_shasum": "eecc083c18fb7bf958ea4f40b57a6640c5a0cc78",
"_shrinkwrap": null,
"_spec": "webpack",
"_where": "C:\\Users\\Djole\\Desktop\\NetNinja\\webpack-playlist",
"author": {
"name": "Tobias Koppers #sokra"
},
"bin": {
"webpack": "./bin/webpack.js"
},
"bugs": {
"url": "https://github.com/webpack/webpack/issues"
},
"dependencies": {
"acorn": "^4.0.4",
"acorn-dynamic-import": "^2.0.0",
"ajv": "^4.7.0",
"ajv-keywords": "^1.1.1",
"async": "^2.1.2",
"enhanced-resolve": "^3.0.0",
"interpret": "^1.0.0",
"json-loader": "^0.5.4",
"loader-runner": "^2.3.0",
"loader-utils": "^0.2.16",
"memory-fs": "~0.4.1",
"mkdirp": "~0.5.0",
"node-libs-browser": "^2.0.0",
"source-map": "^0.5.3",
"supports-color": "^3.1.0",
"tapable": "~0.2.5",
"uglify-js": "^2.8.5",
"watchpack": "^1.3.1",
"webpack-sources": "^0.2.3",
"yargs": "^6.0.0"
},
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
"devDependencies": {
"beautify-lint": "^1.0.3",
"benchmark": "^2.1.1",
"bundle-loader": "~0.5.0",
"codacy-coverage": "^2.0.1",
"codecov.io": "^0.1.2",
"coffee-loader": "~0.7.1",
"coffee-script": "^1.10.0",
"coveralls": "^2.11.2",
"css-loader": "~0.25.0",
"es6-promise-polyfill": "^1.1.1",
"eslint": "3.12.2",
"eslint-plugin-node": "^3.0.5",
"express": "~4.13.1",
"extract-text-webpack-plugin": "^2.0.0-beta",
"file-loader": "~0.9.0",
"i18n-webpack-plugin": "^0.3.0",
"istanbul": "^0.4.5",
"jade": "^1.11.0",
"jade-loader": "~0.8.0",
"js-beautify": "^1.5.10",
"less": "^2.5.1",
"less-loader": "^2.0.0",
"lodash": "^4.17.4",
"mocha": "^3.2.0",
"mocha-lcov-reporter": "^1.0.0",
"nsp": "^2.6.1",
"raw-loader": "~0.5.0",
"react": "^15.2.1",
"react-dom": "^15.2.1",
"script-loader": "~0.7.0",
"should": "^11.1.1",
"simple-git": "^1.65.0",
"sinon": "^1.17.7",
"style-loader": "~0.13.0",
"url-loader": "~0.5.0",
"val-loader": "~0.5.0",
"vm-browserify": "~0.0.0",
"webpack-dev-middleware": "^1.9.0",
"worker-loader": "~0.7.0"
},
"directories": {},
"dist": {
"shasum": "eecc083c18fb7bf958ea4f40b57a6640c5a0cc78",
"tarball": "https://registry.npmjs.org/webpack/-/webpack-2.3.3.tgz"
},
"engines": {
"node": ">=4.3.0 <5.0.0 || >=5.10"
},
"files": [
"lib/",
"bin/",
"buildin/",
"hot/",
"web_modules/",
"schemas/"
],
"gitHead": "ba24c1b163dc038ed738eb4a57dcb241bf63146d",
"homepage": "https://github.com/webpack/webpack",
"license": "MIT",
"main": "lib/webpack.js",
"maintainers": [
{
"name": "jhnns",
"email": "mail#johannesewald.de"
},
{
"name": "sokra",
"email": "tobias.koppers#googlemail.com"
},
{
"name": "thelarkinn",
"email": "sean.larkin#cuw.edu"
}
],
"name": "webpack",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/webpack/webpack.git"
},
"scripts": {
"appveyor:benchmark": "npm run benchmark",
"appveyor:test": "node --max_old_space_size=4096 node_modules\\mocha\\bin\\mocha --harmony test/*.test.js",
"beautify-lint": "beautify-lint 'lib/**/*.js' 'hot/**/*.js' 'bin/**/*.js' 'benchmark/*.js' 'test/*.js'",
"benchmark": "mocha test/*.benchmark.js --harmony -R spec",
"build:examples": "cd examples && node buildAll.js",
"cover": "node --harmony ./node_modules/istanbul/lib/cli.js cover -x '**/*.runtime.js' node_modules/mocha/bin/_mocha -- test/*.test.js",
"cover:min": "node --harmony ./node_modules/.bin/istanbul cover -x '**/*.runtime.js' --report lcovonly node_modules/mocha/bin/_mocha -- test/*.test.js",
"lint": "eslint lib bin hot buildin test/**/webpack.config.js test/binCases/**/test.js examples/**/webpack.config.js",
"lint-files": "npm run lint && npm run beautify-lint",
"nsp": "nsp check --output summary",
"pretest": "npm run lint-files",
"publish-patch": "npm run lint && npm run beautify-lint && mocha && npm version patch && git push && git push --tags && npm publish",
"test": "mocha test/*.test.js --harmony --check-leaks",
"travis:benchmark": "npm run benchmark",
"travis:lint": "npm run lint-files && npm run nsp",
"travis:test": "npm run cover:min"
},
"version": "2.3.3",
"web": "lib/webpack.web.js"
}
EDIT:
I've come with following solution in the end:
Add this to your package.json file
"scripts" : {
"build" : "webpack ./entry.js bundle.js"
}
and then type npm run build this will still run the local version because npm will first look in ./node_modules/.bin/
That kind of path is what is used in a git for Windows bash.
See this issue
We use cmdr (http://cmder.net/ ) to emulate console on Windows machines.
Still we had to modify scripts and separate build to clean and build tasks to get it working.
"scripts": {
"clean": "rm -rf dist",
"build": "node_modules/.bin/babel-node -- ./node_modules/webpack/bin/webpack.js --stats --config ./webpack/prod.config.js",
...
},
You can see a similar instruction in this project package.json:
"build-main": "cross-env NODE_ENV=production node -r babel-register ./node_modules/webpack/bin/webpack --config webpack.config.electron.js --progress --profile --colors",

Resources