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
es6 import not working #31
Comments
I solved it by using |
@ichbinedgar Wont you need the from, to declare from which module you need to import from? For the fun of it i tried it out and as expected an error occured, 'zipcelx' not defined. |
@Nopzen I'm not an expert, but what I understand is that is equivalent to https://stackoverflow.com/questions/42251503/javascript-es6-import-without-a-name I did not use |
|
i made a es6 branch, I think this is how it should work, but i am not sure how to combine it with standalone I also noticed that when using the module it was global (window.zipcelx) If you are interested,check the changes I made changes are in usage: |
@guushamann Thank you for your contribution. There are a few things misunderstood from your changes: Tree shakingThere's nothing to tree shake in zipcelx, there's only one export, so you don't get any benefits of doing a default vs named import. Neither should be the case for modules w/multiple exports, but that's irrelevant in this case. Rollup configWe with to have all three builds still. The standalone build is to support the requests made by a few people: #19 (#13) |
After developing #30 i stumbled across an issue, where I was not able to use the es6
import
syntax, to import this module in a non ejectedcreate-react-app
setup.create-react-app
before ejecting it has its own magical webpack setup, and upon digging abit I found a post on the webpack tracker that talked about multiple builds in npm module package file, and how webpack by default uses thebrowser
key.Upon inspecting our setup i saw the
lib/standalone.js
was the one stored on the browser key, when i tried to import this module the following error happens:I tried to swap the
standalone.js
with thebundle.js
and then everything works, I think there is a bug with the waystandalone.js
exports this module to the browsers.I did find this post also on the webpack issue tracker, webpack/webpack#1979 suggesting how you can order
mainFields
in your webpack resolver, but I haven't tested this or if this is remotly related to this case here.The text was updated successfully, but these errors were encountered: