在 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 } 从 'ngx-bootstrap/datepicker'
更改为import { BsDaterangepickerDirective } 从 '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
./node_modules/ngx-bootstrap-base/src/index.ts 中的错误模块构建失败:错误:TypeScript 编译中缺少 NPMLINK_TEST/node_modules/ngx-bootstrap-base/src/index.ts.请通过文件"或包含"属性确保它在您的 tsconfig 中.丢失的文件似乎是第三方库的一部分.已发布库中的 TS 文件通常是库打包不当的标志.请在库存储库中打开一个问题以提醒其作者并要求他们使用 Angular 包格式打包库在 AngularCompilerPlugin.getCompiledFile (NPMLINK_TEST/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:656:23)在 plugin.done.then (NPMLINK_TEST/node_modules/@ngtools/webpack/src/loader.js:467:39)在<匿名>在 process._tickCallback (internal/process/next_tick.js:182:7)@ ./src/app/app.module.ts 49:12-45 54:12-45@ ./src/main.ts@ 多 webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts./node_modules/ngx-bootstrap-base/src/modal/index.ts 中的错误模块构建失败:错误:TypeScript 编译中缺少 NPMLINK_TEST/node_modules/ngx-bootstrap-base/src/modal/index.ts.请通过文件"或包含"属性确保它在您的 tsconfig 中.丢失的文件似乎是第三方库的一部分.已发布库中的 TS 文件通常是库打包不当的标志.请在库存储库中打开一个问题以提醒其作者并要求他们使用 Angular 包格式打包库在 AngularCompilerPlugin.getCompiledFile (NPMLINK_TEST/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:656:23)在 plugin.done.then (NPMLINK_TEST/node_modules/@ngtools/webpack/src/loader.js:467:39)在<匿名>在 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导出成员queueScheduler".node_modules/ngx-bootstrap-base/src/tooltip/tooltip.directive.ts(20,10): 错误 TS2305: 模块 '"NPMLINK_TEST/node_modules/rxjs/Rx"' 没有导出成员 'timer'.node_modules/ngx-bootstrap-base/src/typeahead/typeahead.directive.ts(18,10): 错误 TS2305: 模块 '"NPMLINK_TEST/node_modules/rxjs/Rx"' 没有导出成员 'from'.
使用 npm 链接
我已经在 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 错误类型错误:无法读取未定义的属性时间表"在 ObserveOnSubscriber.scheduleMessage (observeOn.js:99)在 ObserveOnSubscriber._error (observeOn.js:105)在 ObserveOnSubscriber.Subscriber.error (Subscriber.js:105)在 BehaviorSubject.Observable._trySubscribe (Observable.js:177)在 BehaviorSubject.Subject._trySubscribe (Subject.js:97)在 BehaviorSubject.Observable.subscribe (Observable.js:160)在 ObserveOnOperator.call (observeOn.js:74)在 AnonymousSubject.Observable.subscribe (Observable.js:157)在 ScanOperator.call (scan.js:72)在 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 = "=>"
看到下一个图标变成了 =>
see that next icon changes to =>
这篇关于在 node_modules 下的文件中所做的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!