Angular 5项目发布

时间:2018-06-24 17:54:07

标签: angular5 nanogallery

我在我的项目中使用angular-cli并实现了纳米画廊, 现在我要建立我的专案: 如果我运行

  

ng build --prod

将文件上传到主机后,它将在控制台中引发以下错误:

jQuery.Deferred exception: i is not a function R/</</<@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:148258
each@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:22422
R/</<@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:145805
R/<@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:145721
R@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:145629
h@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:108785
l@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:108322
r/this.initiateGallery2@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:237166
t.nanogallery2/i.init@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:263620
t.nanogallery2@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:263679
jQuery.fn.nanogallery2/<@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:271921
each@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:22422
each@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:21097
jQuery.fn.nanogallery2@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:271900
M4vW/j</l.prototype.loadBranches/</<@http://ankiweb.ir/4.1155fed864443988871c.chunk.js:1:19424
u@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:48959
r/</h<@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:49257
ZSR1/</</</u</t.prototype.invokeTask@http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:19495
onInvokeTask@http://ankiweb.ir/main.36efe7b363f6a9952e89.bundle.js:1:603433
ZSR1/</</</u</t.prototype.invokeTask@http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:19408
ZSR1/</</</i</e.prototype.runTask@http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:14671
ZSR1/</</</c</e.invokeTask@http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:20589
e/this.invoke<@http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:20474
u/n.args[0]@http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:35813
undefined



ERROR TypeError: "i is not a function"
Rhttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:148258eachhttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:22422Rhttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:145805Rhttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:145721Rhttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:145629hhttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:108785lhttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:108322initiateGallery2http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:237166inithttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:263620nanogallery2http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:263679nanogallery2http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:271921eachhttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:22422eachhttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:21097nanogallery2http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:271900loadBrancheshttp://ankiweb.ir/4.1155fed864443988871c.chunk.js:1:19424uhttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:48959hhttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:49257invokeTaskhttp://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:19495onInvokeTaskhttp://ankiweb.ir/main.36efe7b363f6a9952e89.bundle.js:1:603433invokeTaskhttp://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:19408runTaskhttp://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:14671invokeTaskhttp://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:20589invokehttp://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:204740http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:35813
  

jQuery.Deferred exception: l.branches[u].gallery is undefined M4vW/j</l.prototype.loadBranches/</<@http://ankiweb.ir/4.1155fed864443988871c.chunk.js:1:19176
u@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:48959
r/</h<@http://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:49257
ZSR1/</</</u</t.prototype.invokeTask@http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:19495
onInvokeTask@http://ankiweb.ir/main.36efe7b363f6a9952e89.bundle.js:1:603433
ZSR1/</</</u</t.prototype.invokeTask@http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:19408
ZSR1/</</</i</e.prototype.runTask@http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:14671
ZSR1/</</</c</e.invokeTask@http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:20589
e/this.invoke<@http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:20474
u/n.args[0]@http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:35813
undefined
  

ERROR TypeError: "l.branches[u].gallery is undefined"
loadBrancheshttp://ankiweb.ir/4.1155fed864443988871c.chunk.js:1:19176uhttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:48959hhttp://ankiweb.ir/scripts.0334935c44e8c4e6422d.bundle.js:1:49257invokeTaskhttp://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:19495onInvokeTaskhttp://ankiweb.ir/main.36efe7b363f6a9952e89.bundle.js:1:603433invokeTaskhttp://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:19408runTaskhttp://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:14671invokeTaskhttp://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:20589invokehttp://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:204740http://ankiweb.ir/polyfills.d248127361c9f04ac793.bundle.js:1:35813

除“画廊”外,所有事物均正常运行

但是如果我跑步

  

ng构建

一切正常,包括“图库”

任何人都知道出了什么问题!?

expected behaviour

result of ng build -- prod

谢谢!

1 个答案:

答案 0 :(得分:0)

我通过引用angular.json中没有缩小版本的jquery和nanogallery解决了这个生产问题

所以改变这个...

        "scripts": [
          "node_modules/jquery/dist/jquery.min.js",
          "node_modules/nanogallery2/dist/jquery.nanogallery2.min.js"
        ]

对此...

        "scripts": [
          "node_modules/jquery/dist/jquery.js",
          "node_modules/nanogallery2/dist/jquery.nanogallery2.js"
        ]

我不明白为什么,但是已经缩小的nanogallery jquery插件的缩小和捆绑导致了此问题。