build-optimizer: Cannot read property 'call' of undefined #403
Description
Bug Report or Feature Request (mark with an x
)
- [x ] bug report -> please search issues before submitting
- [ ] feature request
Area
- [ x] devkit
- [ ] schematics
Versions
build-optimizer: 0.0.41
Node: v9.4.0
OS: macOS High Sierra
Repro steps
1. Create a new angular-cli installation and install ngx-quill:
ng new quill
yarn add ngx-quill
2. Import ngx-quill to src/app/app.module.ts
import { QuillModule } from 'ngx-quill';
@NgModule({
imports: [QuillModule]
})
3. Add quill-editor to your component template:
@Component({
selector: 'app-root',
template: '<quill-editor></quill-editor>,
})
4. Create a production build using build-optimizer
ng build --prod --aot --build-optimizer
The log given by the failure
Uncaught TypeError: Cannot read property 'call' of undefined
Desired functionality
In the example above, it should display the quill-editor
library when using the build-optimizer
flag.
Mention any other details that might be useful
createTslibImport
is being called in build-optimizer/src/transforms/import-tslib
even if it doesn't pass the criteria set in testImportTslib
(e.g. using webpack_require).
Adding a new check on line 41 (isHelperName(name) && testImportTslib(name)
) fixes this issue. I'm not sure if that's the right solution as it seems to be just a helper function. Maybe create a new one that checks if it's using __webpack_require__
?