我将angular-datatables添加到我的项目中,并定制了我的表。它在本地运行得很好,但是当我把它放到生产服务器上时,所有的定制都消失了--没有滚动条,没有排序选项,没有分页等等。但它在我的angular.json中。我运行了ng build。问题会是什么呢?
这是我的angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"pd-free-angularcli": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"allowedCommonJsDependencies": [
"chart.js"
],
"assets": [
"src/assets",
"src/assets/img/cloadlogo.png",
{
"input": "./node_modules/@google/markerclustererplus/images",
"glob": "*",
"output": "/images"
}
],
"styles": [
"src/styles.scss",
"src/assets/scss/cload-theme.scss",
"./node_modules/ngx-toastr/toastr.css",
"./node_modules/datatables.net-bs4/css/dataTables.bootstrap4.min.css",
"node_modules/datatables.net-dt/css/jquery.dataTables.css"
],
"scripts": [
"./node_modules/jquery/dist/jquery.js",
"node_modules/datatables.net/js/jquery.dataTables.js",
"./node_modules/datatables.net-bs4/js/dataTables.bootstrap4.min.js",
"node_modules/jquery/dist/jquery.js"
],
"aot": false,
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "pd-free-angularcli:build"
},
"configurations": {
"production": {
"browserTarget": "pd-free-angularcli:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "pd-free-angularcli:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"scripts": [
"./node_modules/jquery/dist/jquery.js",
"./node_modules/arrive/src/arrive.js",
"./node_modules/moment/moment.js",
"./node_modules/bootstrap-notify/bootstrap-notify.js",
"https://code.jquery.com/jquery-3.4.1.min.js",
"https://unpkg.com/bootstrap-show-password@1.2.1/dist/bootstrap-show-password.min.js"
],
"styles": [
"src/styles.scss",
"src/assets/sass/cload-theme.scss"
],
"assets": [
"src/assets",
"src/assets/img/favicon.png",
"src/favicon.png"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json"
],
"exclude": []
}
}
}
},
"pd-free-angularcli-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "pd-free-angularcli:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": []
}
}
}
}
},
"defaultProject": "pd-free-angularcli",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
}
},
"cli": {
"analytics": false
}
}发布于 2021-07-12 20:49:05
我解决了!
问题出在脚本的顺序上。
它应该是jQuery FIRST。
https://stackoverflow.com/questions/68345113
复制相似问题