-
-
Notifications
You must be signed in to change notification settings - Fork 0
slack project ts 2019 08 14
akabeko edited this page Nov 16, 2019
·
1 revision
Time | Icon | Name | Message |
---|---|---|---|
01:19 | shinyu |
@Johannes Wilm Yes, when I say “modern browser” it includes Firefox, Chrome, Safari and Edge that support ES6 syntax natively.I tried both buble({ transforms: { forOf: false } }) and buble({ transforms: { dangerousForOf: true } }) options that the plugin buble’s error message suggests (I think dangerousForOf: true should be ok because all for-of are used for array in our TS code). However I got another error again (same error in both options):[!] (plugin buble) TypeError: Cannot read property 'type' of null @Johannes Wilm Could you check this error? |
|
05:36 | Johannes Wilm | Ok. I also saw that error yesterday. I thought it was because somewhere it was not using an array. I'll have a look. | |
07:08 | shinyu | Added “build-debug” script that outputs “vivliostyle.min.js” with source map https://github.com/vivliostyle/vivliostyle.js/commit/e4db6dabbb78b6db27fec1e3b37b3e31336ce30a This build mode is for debugging vivliostyle.js with projects such as vivliostyle-print and vivliostyle-savepdf. |
|
07:19 | Johannes Wilm | ok, I made a "next" branch in which I switched to use babel instead of buble and it worked fine. Anyone using the package downstream with buble will have the same problem though, so it's probably best to try to debug this. | |
07:37 | Johannes Wilm | hmm, this is odd. I still get the error with buble and vivliostyle@next... | |
07:41 | Johannes Wilm | and also if I use a local vivliostyle.js built with "npm run build". | |
07:41 | Johannes Wilm | however, if I use a build that was created with "build-debug", it works fine. | |
09:12 | Johannes Wilm |
@shinyu Should there not also be a "types"/"typings" entry in the package.json file of vivliostyle.js? |
|
09:33 | Johannes Wilm | With a small fix and changing the target of vivliostyle to ES5, it is working. This is relevant as it explains why typescript projects don't export to esm yet: https://github.com/Microsoft/TypeScript/issues/15833By allowing multiple targets, transpilation speeds would be vastly improved for any project doing this already, as the AST only needs to be generated once. |
|
09:46 | shinyu |
@Johannes Wilm Thanks! You changed to "target": "ES5" in tsconfig.json and fix “TS2569: Type ‘NamedNodeMap’ is not an array type or a string type.“? Could you make pull req? |
|
09:52 | Johannes Wilm | yes, I am trying right now to see if I can make multiple targets in vivliostyle.js work so that we can have one ES5 build and one ES2018. | |
09:52 | Johannes Wilm | ES5 is interesting also for modern browsers because it executes a lot faster | |
09:53 | Johannes Wilm | will make a PR when I have something | |
10:09 | Johannes Wilm | Ok, there is a PR now https://github.com/vivliostyle/vivliostyle.js/pull/538/files | |
10:10 | Johannes Wilm | It has been a while since I last looked at advantages/disadvantages of building old and new ES versions | |
10:11 | Johannes Wilm | things may have changed | |
10:35 | shinyu | Thanks. I tested “npm run build” and both “vivliostyle.min.js” and “vivliostyle-es5.min.js” generated. Question: if “vivliostyle-es5.min.js” has advantage, is there reasons both are necessary? |
|
10:38 | Johannes Wilm | well, long term the plan is for ES to move to esm. So I usually export both (es5 as "main" and "esm as "module"). But I don't really know whether there are any concrete advantages to using the ES2018 version. | |
10:39 | Johannes Wilm | maybe something we should ask someone else about? | |
10:41 | shinyu |
@spring-raining your opinion? |
|
10:43 | Johannes Wilm | to note: this only works with the vivliostyle-print branch: next. In that I made sure that it doesn't import the "module" version of vivliostyle.js and takes the "main" version instead. | |
10:48 | spring-raining | It is interesting that ES5 built is faster than ES2018 one. Do you know concrete example of output code between two? | |
10:50 | spring-raining | If it's true, we might make ES5 version as primal option. | |
11:00 | Johannes Wilm | https://fhinkel.rocks/six-speed/ | |
11:00 | Johannes Wilm | it looks like ES2015+ has improved in a lot of areas and is now just as quick for a lot of things, But there are also regressions. | |
11:04 | Johannes Wilm | if I read this chart correctly, there are probably situations where ES2015+ makes more sense. But we should remember that people use vivliostyle in all kinds of projects, and so they may be limited to ES5 for other reasons - not just IE11 - for example because other parts of their app works better/faster with ES5. So I don't think it is a good idea for everyone to only be able to make vivliostyle a dependency if they upgrade to ES2018. | |
11:21 | Johannes Wilm | vivliostyle-print also outputs both an esm and an es5 version | |
13:06 | shinyu | Ok, thanks. I merged the PR. | |
13:55 | shinyu | Now vivliostyle@next on npm includes both vivliostyle.min.js and vivliostyle-es5.min.js .Vivliostyle viewer is now built with vivliostyle-es5.min.js . I tested it with IE11 (I think this is not important, but for test), and got error in IE11's console “Promise is undefined”.I found that the dynamic import import("./layoututil").then( https://github.com/vivliostyle/vivliostyle.js/blob/master/src/ts/vivliostyle/selectors.ts#L43 is transpiled to Promise.resolve(/*! import() */).then(__webpack_require__.bind(null, /*! ./layoututil */ "./src/ts/vivliostyle/layoututil.ts")).then( and the Promise is not supported by IE11.import("./layoututil").then(it => { |
|
14:02 | Johannes Wilm | There is a solution for that. | |
14:03 | Johannes Wilm | I had a similar problem for another package recently. | |
14:05 | Johannes Wilm | See here https://github.com/fiduswriter/Simple-DataTables/issues/14The |
|
14:06 | Johannes Wilm | He managed to get dynamic imports compiled into the original using browserify. |