Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

build-optimizer: Cannot read property 'call' of undefined #403

Closed
ceolinwill opened this issue Jan 22, 2018 · 1 comment
Closed

build-optimizer: Cannot read property 'call' of undefined #403

ceolinwill opened this issue Jan 22, 2018 · 1 comment

Comments

@ceolinwill
Copy link

ceolinwill commented Jan 22, 2018

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__?

@filipesilva
Copy link
Contributor

Heya, thanks for the detailed report and resolution suggestion!

@clydin this looks to be a side effect of #346. Do you prefer to restore the regex check or add stricter checks inside the transformer?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants