-
-
Notifications
You must be signed in to change notification settings - Fork 635
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
modules not exported the same way between es5 and es6 builds #903
Comments
HI @rikkertkoppes module root was dropped away from package.json. Are you using |
@longlho Any idea what could cause this? |
No, not using When I modified |
@rikkertkoppes do you have your |
Both are handled by grunt, but these are the options set for them ts:
webpack:
|
do you mind making a small example repo to demo the issues? Looking at the configs things seem fine |
Yeah sure, probably after the weekend though |
here you go: https://github.com/rikkertkoppes/infernoBuildProblem I included the ts build and the webpack bundle files in the repo. Description in the readme Just checkout and open the html file, note that the console logs undefined and an error, which is exactly what I observe |
awesome thanks! |
yeah confirm the prob is that we dist UMD ES5 but type def still assumes it's ES6. The solution is prob to set main as non-rollup (transpiled only) and set @Havunen thoughts? |
@longlho Sounds good to me |
I also have an issue with importing default export in typescript. Currently import * as h from 'inferno-hyperscript' In this case I have the function, but typings is missing. I found temporary solution using proxy module, like that: import {VNode, InfernoChildren} from 'inferno';
import * as h_ from 'inferno-hyperscript';
export interface H {
(_tag: string | VNode | Function, _props?: any, _children?: InfernoChildren): VNode;
}
export const h: H = h_ as any; |
Can you guys try canary tag w/ |
As of inferno@1.4.2, the As a temp workaround, you can update resolve.mainFields in your webpack config to ignore the |
yeah I think this is still wrong. When using webpack we should import dist/index.js the non minified or bundled es5 code, and webpack will handle the requires. Then those full bundles Anyway it "works" now, so I think this fix is not critical and can wait for 1.5 |
@moatra Does it work with webpack-dev-server? I got |
@Havunen I guess it's critical because of webpack-dev-server :) |
@TrySound strange. We are using Webpack Dev server with Inferno also at work, but didn't notice any issue |
This without
|
that's bc of |
we have one more option, add webpack entry point ... :-) |
somebody add test cases for this |
can you guys try out if latest canary works for you |
The latest canary has fixed the issue for me 👍 |
Installed Observed the following for
|
I think this is now fixed. Closing. Please comment or file new issue if you guys still have problems with this. |
Working with RC.8 here, I am using the following stack:
typescript 2.1.4
webpack 2.2.1
When packing inferno, I run into issues with how the modules are exported. When working in typescript, the typings from
dist-es/index.d.ts
are correctly resolved, indicating that, for example,Component
is the default export frominferno-component
. Typescript build phase works ok.Next inline is the webpack build phase, which picks up the
main
field from package.json, pointing todist/inferno-component.node.js
. Which is ok, as I don't want es6 code in browsers just yet.However, the es5 build exports Component as the root export, which is not how it is expected to be.
This all worked fine with inferno 1.2.2, so this breaks the upgrade path, which I think is not desired
I would suggest aligning the module signature across es5 and es6 builds, unless I am missing something here
The text was updated successfully, but these errors were encountered: