Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporting a global, then using "import * as", then calling a method on that imported global, loses the method property access #570

Closed
Conduitry opened this issue Mar 23, 2016 · 3 comments

Comments

@Conduitry
Copy link
Contributor

This issue appeared in 0.25.5.

main.js:

import * as moduleContents from './global-exporter';
moduleContents.exportedGlobal.someMethod();

global-exporter.js:

export var exportedGlobal = someGlobal;

result:

'use strict';

var exportedGlobal = someGlobal;

exportedGlobal();

the .someMethod gets eaten, and the resulting code tries to call the export directly as a function.

Playground link:

http://rollupjs.org/#{%22options%22%3A{%22format%22%3A%22cjs%22%2C%22moduleName%22%3A%22myBundle%22%2C%22globals%22%3A{}}%2C%22modules%22%3A[{%22name%22%3A%22main.js%22%2C%22code%22%3A%22import%20*%20as%20moduleContents%20from%20%27.%2Fglobal-exporter%27%3B\nmoduleContents.exportedGlobal.someMethod%28%29%3B%22}%2C{%22name%22%3A%22global-exporter.js%22%2C%22code%22%3A%22export%20var%20exportedGlobal%20%3D%20someGlobal%3B%22}]}

@Victorystick
Copy link
Contributor

@Conduitry This is most certainly due to a regression in #566. A fix for it is inbound as of #569.

@Rich-Harris
Copy link
Contributor

Looks like this is fixed and released! Closing

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

No branches or pull requests

3 participants