-
Notifications
You must be signed in to change notification settings - Fork 7
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
cssauron and babel #18
Comments
Also, I see that the package contains |
Are you using webpack, or |
I am using webpack. I have to admit I am really confused. I don't really understand how the |
Cssauron is actually in commonjs. |
Actually no, babel doesn't seem to compile the same way typescript does. Here is my test input file import * as cssauron from 'cssauron'
console.log(cssauron); Which compiles to 'use strict';
var _cssauron = require('cssauron');
var cssauron = _interopRequireWildcard(_cssauron);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
console.log(cssauron); And when I execute the compiled part, here is the output { default: [Function: language] } So Babel automatically added the |
I think the problem is with the custom I am trying to fix this, but I have no idea how to do that ... :/ |
Well it seems the problem is not new microsoft/TypeScript#5285 and there seems to be a |
I've actually had this exact problem before, now that I think of it. The solution is fairly terrible, but maybe it's worth the hassle. I created a wrapper library that handled the differences in exports between commonjs and es2015 correctly. https://github.com/TylorS/typed-i18next |
Outch :/ This is bad news! Do you know any way I could tell I am also using |
Using |
arf, no it still imports the Anyhow, I have tested many thing to fix this, but cannot find a suitable solution :( I am really confused about this... |
Ok so finally I found a solution to my problem. I changed the resolve: {
mainFields: ["main", "module"]
} So now I use the That being said, I feel we should remove the |
That seems like a very good short term solution. |
thanks @atromc . extra reading >> http://www.thedreaming.org/2017/04/28/es6-imports-babel/ but yeah might be worth to make it work seamlessly on browser env without the hack |
…l compilation errors
Fix #18 Remove 'module' and 'jsnext:main' targets
Ok so I am not sure where the problem comes from exactly but here is what I am experiencing
es5
so I need to give thejs
files to babel (and Uglify doesn't accept manyes6
features so it crashes when trying to minify the bundle)The thing is,
cssauron
is imported as follow (in the generatedes2015
file in/lib
)Which is then compiled, by
babel
, intoAnd so my app now crashes.
I really don't know where the problem lies (my babel config file? my typescript config file? the import of
cssauron
? ...)Do you have any idea how I can deal with this? I think updating the import to
would fix the problem, but maybe it's not THE solution.
The text was updated successfully, but these errors were encountered: