I tried to use this tutorial, to install webpack to asp.net core project
Here is command in my package.json
{
"name": "streamline",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"wbp": "webpack wwwroot/source/app.js wwwroot/dist/bundle.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"webpack": "^4.16.0",
"webpack-command": "^0.4.1"
}
}
But when I run it with npm run wbp
I get this
internal/modules/cjs/loader.js:596 throw err; ^
Error: Cannot find module 'import-local' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15) at Function.Module._load (internal/modules/cjs/loader.js:520:25) at Module.require (internal/modules/cjs/loader.js:650:17) at require (internal/modules/cjs/helpers.js:20:18) at Object. (/Users/nemesises/Documents/GitHub/streamline/Streamline/node_modules/webpack-command/lib/cli.js:11:21) at Module._compile (internal/modules/cjs/loader.js:702:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10) at Module.load (internal/modules/cjs/loader.js:612:32) at tryModuleLoad (internal/modules/cjs/loader.js:551:12) at Function.Module._load (internal/modules/cjs/loader.js:543:3) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] wbp:
webpack wwwroot/source/app.js wwwroot/dist/bundle.js
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] wbp script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in: npm ERR!
/Users/nemesises/.npm/_logs/2018-07-13T14_21_24_555Z-debug.log
How I can fix it?
UPDATE
After I make this
"wbp": "webpack --entry wwwroot/source/app.js --output wwwroot/dist/bundle.js"
Reinstall npm packages and try to run command
I got this error
ERROR in Entry module not found: Error: Can't resolve 'wwwroot/source/app.js' in '/Users/nemesises/Documents/GitHub/streamline/StreamLine' npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! [email protected] wbp:
webpack --entry wwwroot/source/app.js --output wwwroot/dist/bundle.js
npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the [email protected] wbp script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in: npm ERR!
/Users/nemesises/.npm/_logs/2018-07-14T19_45_54_642Z-debug.log
But I got this file in my folder!
If I use my old command and create dist/bundle.js
it works, but bundle.js
is empty