-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Description
🐞 Bug report
Command (mark with an x
)
- [ ] new
- [X] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Is this a regression?
Not sure. According to the documentation of the library I'm using, I think they assume it's always worked.Description
I'm using [angulartics2](https://github.com/angulartics/angulartics2), which provides integrations with 3rd party analytics such as Google Analytics. One of the features of this library is watching and reporting route changes. There is a configuration option to clean up `id` references in routes, documentation is [here](https://github.com/angulartics/angulartics2#remove-ids-from-url-paths).My configuration for this module is as follows:
Angulartics2Module.forRoot({
pageTracking: {
clearIds: true,
idsRegExp: /^[a-zA-Z]+-[0-9a-zA-Z_-]{22}$/
}
})
When building for production (ng build --prod
) and using a RegExp (non-constructor variant), it gives me this exception.
Date: 2019-02-18T20:42:19.190Z
Hash: f87abc34a327d3cd4386
Time: 5030ms
chunk {0} runtime.a5dd35324ddfd942bef1.js (runtime) 1.41 kB [entry] [rendered]
chunk {1} es2015-polyfills.67c5cff8371af1f9a1d4.js (es2015-polyfills) 56.4 kB [initial] [rendered]
chunk {2} main.cde404c57fbcc43faae1.js (main) 128 bytes [initial] [rendered]
chunk {3} polyfills.70c2c870c3a0f5c90635.js (polyfills) 130 bytes [initial] [rendered]
chunk {4} styles.3ff695c00d717f2d2a11.css (styles) 0 bytes [initial] [rendered]
ERROR in app/app.module.ts(18,20): Error during template compile of 'AppModule'
Expression form not supported.
Alternatively, when using the constructor format,
Angulartics2Module.forRoot({
pageTracking: {
clearIds: true,
idsRegExp: new RegExp('^[a-zA-Z]+-[0-9a-zA-Z_-]{22}$')
}
})
The above actually compiles and builds the distribution, but if you look at the distributed JS, it has removed that particular line and the output JS looks like:
r.qb(256,H,{settings:{pageTracking:{clearIds:!0}}}
🔬 Minimal Reproduction
ng new test
cd test
npm install --save angulartics2
Import and add the following to the main AppModule
import {Angulartics2Module} from 'angulartics2';
...
Angulartics2Module.forRoot({
pageTracking: {
clearIds: true,
idsRegExp: /^[a-zA-Z]+-[0-9a-zA-Z_-]{22}$/ // Throws exception
// idsRegExp: new RegExp('^[a-zA-Z]+-[0-9a-zA-Z_-]{22}$') // Not compiled to output
}
})
Then run ng build --prod
. The error is:
ERROR in app/app.module.ts(18,20): Error during template compile of 'AppModule'
Expression form not supported.
Use the other variant and check the dist/foobar/main.xxxxxxx.js
file. Do a find for clearIds
. Notice no key in that same dict is defined for idsRegExp
.
🔥 Exception or Error
ERROR in app/app.module.ts(18,20): Error during template compile of 'AppModule'
Expression form not supported.
🌍 Your Environment
Angular CLI: 7.3.2
Node: 11.9.0
OS: darwin x64
Angular: 7.2.5
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.13.2
@angular-devkit/build-angular 0.13.2
@angular-devkit/build-optimizer 0.13.2
@angular-devkit/build-webpack 0.13.2
@angular-devkit/core 7.3.2
@angular-devkit/schematics 7.3.2
@angular/cli 7.3.2
@ngtools/webpack 7.3.2
@schematics/angular 7.3.2
@schematics/update 0.13.2
rxjs 6.3.3
typescript 3.2.4
webpack 4.29.0
Anything else relevant?
Mac OSX 10.14.3
Metadata
Metadata
Assignees
Labels
No labels