Skip to content

Not support for Rollup in AOT mode #85

@miao17game

Description

@miao17game

I'm submitting a...


[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Support request => Please do not submit support request here

Current behavior

When i try to rollup for the AOT mode, i find that it's impossible to build with ng-zorro.

the error message is below here:


> ngc -p tsconfig-aot.json && rollup -c rollup-config.js

⚠️   'default' is imported from external module 'rollup' but never used

'default' is not exported by 'node_modules\@angular\common\@angular\common.es5.js'
'default' is not exported by 'node_modules\@angular\core\@angular\core.es5.js'
�   Error: Cannot call a namespace ('moment')
node_modules\ng-zorro-antd\src\release\datepicker\nz-datepicker.component.js (17:26)
15:     this._value = null;
16:     this._today = new Date();
17:     this._selectedMonth = moment(this.nzValue).month();
                              ^
18:     this._selectedYear = moment(this.nzValue).year();
19:     this._selectedDate = moment(this.n

Expected behavior

Minimal reproduction of the problem with instructions

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

the problem is the 'moment', it's imported in time-picker component in this format:


import * as moment from 'moment'

but it's not support in AOT mode.
if i change the format into


import moment from 'moment'

,no errors will be called up, but still some other errors in moment.
if i remove the NG-ZORRO from my angular4 project, there is nothing wrong.
And there is no problems in JIT mode.

I don't think change the source by myself is a good way to resolve this problem.
I need help.

Environment


Angular version: 4.2.4

ng-zorro-antd version: 0.5.0

Browser:
- [x] Chrome (desktop) version 59
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] IE version XX
 
For Tooling issues:
- Node version: XX  
- Platform: Windows7 

Others:

Metadata

Metadata

Assignees

Labels

🙅 Won't FixWe are not going to fix or resolve it

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions