components icon indicating copy to clipboard operation
components copied to clipboard

bug alpha 6-3 - url_resolver.js:238Uncaught TypeError: uri.match is not a function, when using latest compiler-builds

Open qdouble opened this issue 10 years ago • 5 comments

Building a project with alpha 6-3 and the latest compiler build using ngModules seems to crash when you use materials modules. This commit to the compiler broke it: https://github.com/angular/angular/commit/83e2d3d1cb62660bdbb06353edc2e063fc3e56d0

On line 238 of url_resolver.js, if you change

function _split(uri) {
    return uri.match(_splitRe);
}

to

function _split(uri) {
   if (typeof uri === 'string')
    return uri.match(_splitRe);
}

it will work, as it appears that the material modules are exporting numbers instead of strings. If I console.log uri, MdButtonModule will pass it the number 436 and also the string 'package:436' for example. The number is causing the crash.

I know it was mentioned that this is experimental release, but just making sure that this is a known issue and addressed before next release.

qdouble avatar Aug 09 '16 03:08 qdouble

I don't think this is an issue with the released alpha.7. Feel free to re-file if you're still running into a problem.

jelbourn avatar Aug 09 '16 21:08 jelbourn

I updated to MD2 ^2.0.0-alpha.7-7 and I had the same problem. Thanks qdouble for your fix it resolved the issue. RC-5 CLI with webpack.2. :-)

MatteoNY avatar Aug 24 '16 00:08 MatteoNY

Same issue as @MatteoNY, but updating to 2.0.0-alpha.7-8. I reverted to known-good 2.0.0-alpha.7-2 and incremented the version upward until it started breaking again: 2.0.0-alpha.7-5 works, 2.0.0-alpha.7-6 throws the error, as does 2.0.0-alpha.7-8 ( I didn't actually test alpha.7-7)

Uncaught TypeError: uri.match is not a function:
_split  @   url_resolver.js:238
getUrlScheme    @   url_resolver.js:80
componentModuleUrl  @   metadata_resolver.js:750
CompileMetadataResolver.getDirectiveMetadata    @   metadata_resolver.js:155
(anonymous function)    @   metadata_resolver.js:267
CompileMetadataResolver.getNgModuleMetadata @   metadata_resolver.js:260
(anonymous function)    @   metadata_resolver.js:252
CompileMetadataResolver.getNgModuleMetadata @   metadata_resolver.js:239

ggranum avatar Aug 24 '16 15:08 ggranum

The @latest tag on npm still points to alpha.7-4. Releases above that are tagged as @experimental and are not meant for general consumption (they're typically us testing integrations with in-progress work on angular core or Google internal tooling).

jelbourn avatar Aug 24 '16 16:08 jelbourn

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.