簡體   English   中英

在 node_modules 下的文件中所做的更改

[英]Changes made in files under node_modules

我更改了 node_modules 文件夾中的一些文件。 但是當我使用ng build -op="app" --base -href="dist" --aot應用程序並將其部署到服務器時,我發現我在 node_modules 中所做的更改不存在。 如何克服這個?

我嘗試了以下3種方式

  1. 我已經將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'我現在面臨以下異常

    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

  2. 我也試過npm install https://github.com/krishnag9/ngx-bootstrap --save-dev最終出現以下錯誤

    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'.

  3. 使用npm link我已經在我的 node_modules 之外克隆了 git 存儲庫 接下來cd ngx-bootstrap我已經執行了命令npm link重定向到node_modules文件夾在這里我做了npm link ngx-bootstrap我的控制台沒有錯誤,但是我更改的代碼是沒有反映在那里並且在瀏覽器控制台中也面臨異常

    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)

如果你只需要更改圖標,就可以這樣做。 每當觸發datepicker時,您只需添加以下行。

document.querySelector(".previous span").innerHTML = "<="

document.querySelector(".next span").innerHTML = "=>"

你可以用你想要使用的任何圖標來改變"=>"

檢查一下。 轉到https://valor-software.com/ngx-bootstrap/#/datepicker

然后打開任何日期選擇器並打開控制台並將其粘貼到控制台document.querySelector(".next span").innerHTML = "=>"

看到下一個圖標變為=>

您可以使用 npm補丁包共享和保存 node_modules 中的更改 雖然下面的回復在 Stack-overflow 的 React/React Native 部分,它適用於所有 npm 的東西:

https://stackoverflow.com/a/68871879/11583616

這取決於您構建應用程序的方式,可能是您的webpack配置。 向我們展示您的webpack配置,您應該配置您的加載器以包含該模塊。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM