swimlane / ngx-datatable

✨ A feature-rich yet lightweight data-table crafted for Angular
http://swimlane.github.io/ngx-datatable/
MIT License
4.63k stars 1.68k forks source link

__decorate) is not a function #2029

Open RolfVeinoeSorensen opened 2 years ago

RolfVeinoeSorensen commented 2 years ago

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior Getting an error when trying to add ngx-datatable to my latest angular 12 project.

swimlane-ngx-datatable.js:formatted:1 Uncaught TypeError: (0 , tslibWEBPACK_IMPORTED_MODULE_6.decorate) is not a function at Module.600 (swimlane-ngx-datatable.js:formatted:1) at __webpack_require (bootstrap:19) at Module.6747 (app.component.ts:8) at webpack_require (bootstrap:19) at Module.4431 (environment.ts:19) at webpack_require (bootstrap:19) at webpack_exec (log$:23) at log$:23 at Function.webpack_require.O (chunk loaded:23) at log$:23

__decorate([throttleable(5)], DatatableComponent.prototype, "onWindowResize", null);
(function() {
    (typeof ngDevMode === "undefined" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(ScrollbarHelper, [{
        type: Injectable
    }], function() {
        return [{
            type: undefined,
            decorators: [{
                type: Inject,
                args: [DOCUMENT]
            }]
        }];
    }, null);
}
)();

I have set in tsconfig "importHelpers": true, "noEmitHelpers": false,

Expected behavior

ngx-datatable should load

Reproduction of the problem ng new test-datatabe add "@swimlane/ngx-datatable": "^20.0.0" to package,json

add NgxDatatableModule to app.module

https://stackblitz.com/edit/angular-ivy-ovw2bh

What is the motivation / use case for changing the behavior?

Please tell us about your environment: Windows 10 Visual Studio Code

RolfVeinoeSorensen commented 2 years ago

It may be related to "module": "es2020", Here is my tsconfig for the sake of completeness:

/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2017",
    "module": "es2020",
    "lib": [
      "es2018",
      "dom"
    ],
    "paths": {
      "tslib" : ["node_modules/tslib/tslib.d.ts"],
      "@app/*": ["src/app/*"],
      "@shared/*": ["src/app/_shared/*"],
      "@models/*": ["src/app/_models/*"],
      "@helpers/*": ["src/app/_helpers/*"],
      "@services/*": ["src/app/_services/*"],
      "@environments/*": ["src/environments/*"],
      "@user/*": ["src/app/user/*"]
    },
  },
  "angularCompilerOptions": {
    "enableI18nLegacyMessageIdFormat": false,
    "strictInjectionParameters": true,
    "strictInputAccessModifiers": true,
    "strictTemplates": true
  }
}