在node_modules下的文件中所做的更改 [英] Changes made in files under node_modules
问题描述
我更改了node_modules文件夹中的某些文件.但是,当我使用ng build -op="app" --base -href="dist" --aot
构建应用程序并将其部署到服务器时,我发现在node_modules中所做的更改不存在.如何克服这个问题?
I have changed some files present in node_modules folder. But when I build the application using ng build -op="app" --base -href="dist" --aot
and when I deploy it to server I see the changes that I made in node_modules were not there. How to overcome this?
我尝试了以下3种方式
-
我已将
ngx-bootstrap
存储库分叉到 GIT 然后,我在项目中使用了npm install https://github.com/krishnag9/ngx-bootstrap/tarball/master
.我已将import { BsDaterangepickerDirective } from 'ngx-bootstrap/datepicker'
更改为import { BsDaterangepickerDirective } from 'ngx-bootstrap-base/src/datepicker'
我现在面临以下异常
I have forked the
ngx-bootstrap
repository into GIT Then I have usednpm install https://github.com/krishnag9/ngx-bootstrap/tarball/master
in my project. I have changedimport { BsDaterangepickerDirective } from 'ngx-bootstrap/datepicker'
toimport { BsDaterangepickerDirective } from 'ngx-bootstrap-base/src/datepicker'
I'm facing the below exception now
ERROR in ./node_modules/ngx-bootstrap-base/src/index.ts
Module build failed: Error: NPMLINK_TEST/node_modules/ngx-bootstrap-base/src/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format
at AngularCompilerPlugin.getCompiledFile (NPMLINK_TEST/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:656:23)
at plugin.done.then (NPMLINK_TEST/node_modules/@ngtools/webpack/src/loader.js:467:39)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7)
@ ./src/app/app.module.ts 49:12-45 54:12-45
@ ./src/main.ts
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ERROR in ./node_modules/ngx-bootstrap-base/src/modal/index.ts
Module build failed: Error: NPMLINK_TEST/node_modules/ngx-bootstrap-base/src/modal/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format
at AngularCompilerPlugin.getCompiledFile (NPMLINK_TEST/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:656:23)
at plugin.done.then (NPMLINK_TEST/node_modules/@ngtools/webpack/src/loader.js:467:39)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7)
@ ./src/app/canceltickets/canceltickets.component.ts 21:14-53 22:14-53
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ERROR in ./node_modules/ngx-bootstrap-base/src/index.ts
Module build failed: Error: NPMLINK_TEST/node_modules/ngx-bootstrap-base/src/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format
at AngularCompilerPlugin.getCompiledFile (NPMLINK_TEST/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:656:23)
at plugin.done.then (NPMLINK_TEST/node_modules/@ngtools/webpack/src/loader.js:467:39)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7)
@ ./src/app/app.module.ts 49:12-45 54:12-45
@ ./src/main.ts
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ERROR in ./node_modules/ngx-bootstrap-base/src/modal/index.ts
Module build failed: Error: NPMLINK_TEST/node_modules/ngx-bootstrap-base/src/modal/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format
at AngularCompilerPlugin.getCompiledFile (NPMLINK_TEST/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:656:23)
at plugin.done.then (NPMLINK_TEST/node_modules/@ngtools/webpack/src/loader.js:467:39)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:182:7)
@ ./src/app/canceltickets/canceltickets.component.ts 21:14-53 22:14-53
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
我也尝试过npm install https://github.com/krishnag9/ngx-bootstrap --save-dev
最终出现以下错误
Also I have tried npm install https://github.com/krishnag9/ngx-bootstrap --save-dev
ended up with below error
ERROR in node_modules/ngx-bootstrap-base/src/mini-ngrx/state.class.ts(5,39): error TS2305: Module '"NPMLINK_TEST/node_modules/rxjs/Rx"' has no exported member 'queueScheduler'.
node_modules/ngx-bootstrap-base/src/tooltip/tooltip.directive.ts(20,10): error TS2305: Module '"NPMLINK_TEST/node_modules/rxjs/Rx"' has no exported member 'timer'.
node_modules/ngx-bootstrap-base/src/typeahead/typeahead.directive.ts(18,10): error TS2305: Module '"NPMLINK_TEST/node_modules/rxjs/Rx"' has no exported member 'from'.
ERROR in node_modules/ngx-bootstrap-base/src/mini-ngrx/state.class.ts(5,39): error TS2305: Module '"NPMLINK_TEST/node_modules/rxjs/Rx"' has no exported member 'queueScheduler'.
node_modules/ngx-bootstrap-base/src/tooltip/tooltip.directive.ts(20,10): error TS2305: Module '"NPMLINK_TEST/node_modules/rxjs/Rx"' has no exported member 'timer'.
node_modules/ngx-bootstrap-base/src/typeahead/typeahead.directive.ts(18,10): error TS2305: Module '"NPMLINK_TEST/node_modules/rxjs/Rx"' has no exported member 'from'.
使用npm link
我已经在我的node_modules之外克隆了git仓库
下一个cd ngx-bootstrap
我已经执行了命令npm link
重定向到node_modules
文件夹
在这里,我做了npm link ngx-bootstrap
控制台中没有错误,但是我更改的代码未在其中反映出来,并且在浏览器控制台中也面临异常
Using npm link
I have cloned the git repository outside of my node_modules
Next cd ngx-bootstrap
I have executed the command npm link
Redirected to node_modules
folder
Here I did npm link ngx-bootstrap
No errors in my console, But the code I have changed is not reflected there and also facing an exception in browser console
BsDatepickerContainerComponent_Host.ngfactory.js? [sm]:1 ERROR TypeError: Cannot read property 'schedule' of undefined
at ObserveOnSubscriber.scheduleMessage (observeOn.js:99)
at ObserveOnSubscriber._error (observeOn.js:105)
at ObserveOnSubscriber.Subscriber.error (Subscriber.js:105)
at BehaviorSubject.Observable._trySubscribe (Observable.js:177)
at BehaviorSubject.Subject._trySubscribe (Subject.js:97)
at BehaviorSubject.Observable.subscribe (Observable.js:160)
at ObserveOnOperator.call (observeOn.js:74)
at AnonymousSubject.Observable.subscribe (Observable.js:157)
at ScanOperator.call (scan.js:72)
at AnonymousSubject.Observable.subscribe (Observable.js:157)
BsDatepickerContainerComponent_Host.ngfactory.js? [sm]:1 ERROR TypeError: Cannot read property 'schedule' of undefined
at ObserveOnSubscriber.scheduleMessage (observeOn.js:99)
at ObserveOnSubscriber._error (observeOn.js:105)
at ObserveOnSubscriber.Subscriber.error (Subscriber.js:105)
at BehaviorSubject.Observable._trySubscribe (Observable.js:177)
at BehaviorSubject.Subject._trySubscribe (Subject.js:97)
at BehaviorSubject.Observable.subscribe (Observable.js:160)
at ObserveOnOperator.call (observeOn.js:74)
at AnonymousSubject.Observable.subscribe (Observable.js:157)
at ScanOperator.call (scan.js:72)
at AnonymousSubject.Observable.subscribe (Observable.js:157)
推荐答案
如果只需要更改图标,则可以这样做. 每当触发日期选择器时,您都可以在下面添加行.
If you just have to change the icon, You can do it like this. Whenever datepicker is triggered you can just add below lines.
document.querySelector(".previous span").innerHTML = "<="
document.querySelector(".next span").innerHTML = "=>"
您可以使用任何要使用的图标更改"=>"
.
you can change "=>"
with whatever icon you want to use.
要检查此. 转到 https://valor-software.com/ngx-bootstrap/#/datepicker
然后打开任何日期选择器并打开控制台,并将其粘贴到控制台document.querySelector(".next span").innerHTML = "=>"
Then Open any Date Picker and Open console and paste this into console document.querySelector(".next span").innerHTML = "=>"
看到下一个图标变为=>
这篇关于在node_modules下的文件中所做的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!