node_modules breaks build in Visual Studio

℡╲_俬逩灬. 提交于 2019-12-05 10:48:58

install the rimraf package

 npm install rimraf

then in package.json use rimraf command

 'script': {
    'postinstall': 'rimraf node_modules/**/web.config'
 }

Please note that first time you will have to delete it manually, as the package is already installed and postinstall command will not run.

But for all your future installs + for your teammates, it will be taken care of automatically as postinstall command runs after every npm install

Please do read more about npm pre & post hooks

Its more of a work-around, but my making your node_modules folder hidden it won't show up in your solution explorer and Visual Studio will run your project as normal. As far as I could see, this doesn't affect running your web application.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!