-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
after AOT build and run "Cannot read property 'id' of undefined" at setColumnDefaults #396
Comments
I have fixed problem by moving id() into setColumnDefaults() and created new ngx-datatable build. Just wondering if this is problem with my bundling setup utils/id.ts
util/column-helper.ts
|
Seems related to your build. Can you make a demo repo? |
I also have the same problem. Looks like util = require('../utils') in the line below results to undefined, when I place breakpoint in the browser, leading to the error just described in the title.
This is my rollup config, if that's helpful. http://pastebin.com/1ymv3Rw2 |
I discovered the problem, and have a workaround for now. But, I don't know what part of rollup causes this. When I go to the generated rollup bundle file in dist/build.js, I see that the sequences of common js definition and require() are out of order. var utils_1$1 = index$6; Since index$6 happens after the utils assignment, utils_1 will still be undefined. Tried reordering rollup plugins and moved commonJs to the first plugin to run, but still same problem. This looks more like a rollup problem than this module... unless I'm missing a ngx-datatable -specific quirk that makes it not work with rollup. EDIT: In this case, column-helper.js is under utils/, but require utils itself. |
Sounds like we should be able to fix. I'll tweak it but will need ur help testing. |
Thanks for the quick reply! |
+1 - Looks like this is still an issue in 6.1.2. Happy to help testing. |
The issue is that TypeScript does not allow circular dependencies. So within a module you need to reference the other files in that module using relative references rather than importing from the module. Using the following imports in the src/utils/column-helper.ts works.
|
…port Fixes swimlane#396 by using relative imports
Hi all,
Just wondering if anybody is experiencing error that I am describing here.
Current behavior
Expected behavior
sholud be running without error
To reproduce the problem
ngc compile -> rollup bundle -> ran with gulp-webserver
Please tell us about your environment:
Mac 10.11.6, WebStorm, NPM 3.10.8, gulp-webserver
Table version: 0.7.x
4.1.0
Angular version: 2.0.x
2.3.1
Browser: [Chrome]
Language: [TypeScript 2.0.3]
The text was updated successfully, but these errors were encountered: