angular-cli: [6.0.0 Regression] build-optimizer breaks exports
Versions
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 6.0.0
Node: 9.11.1
OS: darwin x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.0
@angular-devkit/build-angular 0.6.0
@angular-devkit/build-optimizer 0.6.0
@angular-devkit/core 0.6.0
@angular-devkit/schematics 0.6.0
@ngtools/webpack 6.0.0
@schematics/angular 0.6.0
@schematics/update 0.6.0
rxjs 6.1.0
typescript 2.7.2
webpack 4.6.0
Repro steps
git clone https://github.com/buu700/ng6-quill-test.git
cd ng6-quill-test
npm install .
ng serve --prod
This project is a small modification of ng new
’s output which adds import 'parchment';
. The relevant code within the parchment
package is as follows:
src/registry.ts:
. . .
export enum Scope {
. . .
INLINE_BLOT = INLINE & BLOT, // 0110
. . .
}
. . .
src/blob/abstract/leaf.ts:
. . .
import * as Registry from '../../registry';
class LeafBlot extends ShadowBlot implements Leaf {
static scope = Registry.Scope.INLINE_BLOT;
. . .
Observed behavior
Logged to console:
Uncaught TypeError: Cannot read property 'INLINE_BLOT' of undefined
Desired behavior
As when building/serving without --prod
, Registry.Scope
should be defined.
Mention any other details that might be useful (optional)
Disabling the build optimizer fixes the issue. I didn’t run into this with 6.0.0-rc.7, so the regression is from some time between 6.0.0-rc.8 and 6.0.0 final.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 31
- Comments: 15 (5 by maintainers)
Setting “buildOptimizer”: false in angular.json did fix the problem for me. The bundle size is as small as before the upgrade to Angular 6.
I manually added
@angular-devkit/build-optimizer@0.6.8
as dev dependency to package json and issue seems to be resolved with this version.Does this happen with the 6.1.x betas?