Skip to content
This repository has been archived by the owner on Mar 15, 2020. It is now read-only.

Cannot read property 'names' of null #1

Closed
FezVrasta opened this issue Dec 31, 2016 · 14 comments
Closed

Cannot read property 'names' of null #1

FezVrasta opened this issue Dec 31, 2016 · 14 comments
Assignees
Labels

Comments

@FezVrasta
Copy link

This is what I get when I try to use this plugin:

TypeError: Cannot read property 'names' of null
    at new Link (/Users/federicozivolo/Progetti/popper-js/node_modules/rollup/src/utils/collapseSourcemaps.js:19:19)
    at /Users/federicozivolo/Progetti/popper-js/node_modules/rollup/src/utils/collapseSourcemaps.js:147:12
    at Array.forEach (native)
    at collapseSourcemaps (/Users/federicozivolo/Progetti/popper-js/node_modules/rollup/src/utils/collapseSourcemaps.js:146:23)
    at Bundle.render (/Users/federicozivolo/Progetti/popper-js/node_modules/rollup/src/Bundle.js:436:11)
    at generate (/Users/federicozivolo/Progetti/popper-js/node_modules/rollup/src/rollup.js:73:28)
    at Object.write (/Users/federicozivolo/Progetti/popper-js/node_modules/rollup/src/rollup.js:102:20)
    at /Users/federicozivolo/Progetti/popper-js/node_modules/rollup/bin/rollup:908:18
    at process._tickCallback (internal/process/next_tick.js:103:7)
    at Module.runMain (module.js:607:11)
@Comandeer Comandeer self-assigned this Dec 31, 2016
@Comandeer Comandeer added the bug label Dec 31, 2016
@FezVrasta
Copy link
Author

Seems like it happens when sourceMap is set to true in Rollup

@Comandeer
Copy link
Owner

Yes, it's caused by the source maps. I've just pushed the basic support for them to the master, so you can use (or at least try to use…) the plugin straight from GH:

npm install Comandeer/rollup-plugin-babili

However the support for source maps is still very buggy and it'll probably fail on any more complex ES6 code.

@FezVrasta
Copy link
Author

Same error with the version from master 😢

@FezVrasta
Copy link
Author

This is the branch where I'm trying to use this plugin, maybe it can help.

https://github.com/FezVrasta/popper.js/tree/v1-dev-babili-plus-jsnext

@FezVrasta
Copy link
Author

With alpha3 I get:

Cannot read property 'traceSegment' of undefined
TypeError: Cannot read property 'traceSegment' of undefined
    at /Users/federicozivolo/Progetti/popper-js/node_modules/rollup/src/utils/collapseSourcemaps.js:33:26
    at Array.forEach (native)
    at /Users/federicozivolo/Progetti/popper-js/node_modules/rollup/src/utils/collapseSourcemaps.js:31:9
    at Array.map (native)
    at Link.traceMappings (/Users/federicozivolo/Progetti/popper-js/node_modules/rollup/src/utils/collapseSourcemaps.js:28:34)
    at collapseSourcemaps (/Users/federicozivolo/Progetti/popper-js/node_modules/rollup/src/utils/collapseSourcemaps.js:150:60)
    at Bundle.render (/Users/federicozivolo/Progetti/popper-js/node_modules/rollup/src/Bundle.js:436:11)
    at generate (/Users/federicozivolo/Progetti/popper-js/node_modules/rollup/src/rollup.js:73:28)
    at Object.write (/Users/federicozivolo/Progetti/popper-js/node_modules/rollup/src/rollup.js:102:20)
    at /Users/federicozivolo/Progetti/popper-js/node_modules/rollup/bin/rollup:908:18

No idea why the result is different from when I used the GitHub URL...

@Comandeer
Copy link
Owner

Sorry, I've forgot that I don't have the dist directory on GitHub… I've just published new version of package on npm (version 1.0.0-alpha3). Maybe it would help.

If it still won't work, you could – as a workaround – use Babili in Rollup using rollup-plugin-babel with babili preset in a similar manner as I'm doing at the moment. The only issue with such approach is the fact that Rollup is minifying every file separately, not the whole bundle (and that's why I'm trying to create this plugin).

@FezVrasta
Copy link
Author

Thanks for the reply. I'm aware of the other method but I don't like the result. Right now I'm simply running babili via command line to get the best result. If you could fix this plugin it would be so much better tho! 🔥

@Comandeer
Copy link
Owner

Strangely enough the issue seems to be present only when bundling to the UMD format. When bundling to the ES format, everything is working fine.

@Comandeer
Copy link
Owner

It seems more like bug in rollup, not the plugin itself. I'll investigate it further.

@FezVrasta
Copy link
Author

Thank you, no rush by me. Once the plugin is ready I'll be happy to switch to it tho 🙂

@Comandeer
Copy link
Owner

I've added simple workaround for it and published in v1.0.0 of plugin. I hope that it will work now.

@brianmhunt
Copy link

This still occurs. See e.g. github.com/knockout/tko – running MINIFY=1 rollup -c rollup.config.js results in:

TypeError: Cannot read property 'traceSegment' of undefined
at /usr/local/lib/node_modules/rollup/src/utils/collapseSourcemaps.js:33:26
at Array.forEach (native)
at /usr/local/lib/node_modules/rollup/src/utils/collapseSourcemaps.js:31:9
at Array.map (native)
at Link.traceMappings (/usr/local/lib/node_modules/rollup/src/utils/collapseSourcemaps.js:28:34)
at collapseSourcemaps (/usr/local/lib/node_modules/rollup/src/utils/collapseSourcemaps.js:150:60)
at Bundle.render (/usr/local/lib/node_modules/rollup/src/Bundle.js:436:11)
at generate (/usr/local/lib/node_modules/rollup/src/rollup.js:73:28)
at Object.write (/usr/local/lib/node_modules/rollup/src/rollup.js:102:20)
at /usr/local/lib/node_modules/rollup/bin/rollup:907:18

@Comandeer
Copy link
Owner

I cannot reproduce this issue, both with local installation of rollup 0.41.6 and with global one.

What version of rollup do you have installed? Because this issue is reproducible only on <0.41.5.

@brianmhunt
Copy link

Thanks, that was indeed the issue!

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

No branches or pull requests

3 participants