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

Not emitting es modules #8

Closed
jtmthf opened this issue Apr 7, 2017 · 2 comments
Closed

Not emitting es modules #8

jtmthf opened this issue Apr 7, 2017 · 2 comments
Assignees
Labels

Comments

@jtmthf
Copy link
Contributor

jtmthf commented Apr 7, 2017

Very useful project here. One concern I had is that in kit/webpack/browser.js, modules is not set to false which means by default import statements are transpiled to commonjs meaning that not all tree shaking optimizations can be taken advantage of. However when I change this, there is no change in size of the output bundle. Not sure exactly why this is, and was wondering if you had an idea.

@leebenson
Copy link
Owner

Thanks @jtmthf, this looks like a bug. I'll work on this today.

@leebenson leebenson self-assigned this Apr 7, 2017
@leebenson leebenson added the bug label Apr 7, 2017
@leebenson
Copy link
Owner

leebenson commented Apr 7, 2017

fixed in 1.4.1.

Demo:

test.js

export const A = 'this should show up';
export const B = 'this should never wind up in the bundle';

app.js

import React from 'react';
import { A } from './test';

export default () => (
  <div>
    {A}
  </div>
);

Resulting dist/public/browser.js bundle:

webpackJsonp([0],{124:function(e,n,t){"use strict";function r(){c.a.render(u.a.createElement(E,null),document.getElementById("main"))}Object.defineProperty(n,"__esModule",{value:!0});var i=t(172),o=(t.n(i),t(5)),u=t.n(o),a=t(187),c=t.n(a),l=t(262),s=t(91),d=(t.n(s),t(141)),f=t(142),=t(143),p=t.i(d.a)(),v=t.i(f.a)(p),E=function(){var e=function(){return u.a.createElement(s.ApolloProvider,{store:v,client:p},u.a.createElement(l.a,null,u.a.createElement(.a,null)))};return e}();r()},140:function(e,n,t){"use strict";t.d(n,"a",function(){return r});var r={uri:"https://api.graph.cool/simple/v1/cinomw2r1018601o42x5z69uc"}},141:function(e,n,t){"use strict";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new u.ApolloClient(Object.assign({reduxRootSelector:function(e){return e.apollo},networkInterface:c},e))}function i(){return r()}var o=t(5),u=(t.n(o),t(91)),a=(t.n(u),t(140));n.a=i;var c=t.i(u.createNetworkInterface)({uri:a.a.uri})},142:function(e,n,t){"use strict";function r(e){return t.i(i.createStore)(t.i(i.combineReducers)({apollo:e.reducer()}),window.STATE,t.i(i.compose)(t.i(i.applyMiddleware)(e.middleware()),void 0!==window.REDUX_DEVTOOLS_EXTENSION?window.REDUX_DEVTOOLS_EXTENSION():function(e){return e}))}var i=t(75);n.a=r},143:function(e,n,t){"use strict";var r=t(5),i=t.n(r),o=t(144);n.a=function(){return i.a.createElement("div",null,o.a)}},144:function(e,n,t){"use strict";t.d(n,"a",function(){return r});var r="this should show up"},291:function(e,n,t){e.exports=t(124)}},[291]);


> No mention of the string in `B`

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

No branches or pull requests

2 participants