Closed jasonqsong closed 5 years ago
Unified can be run in the browser, to do so it needs to be bundled (using webpack, rollup, etc) and transpiled (babel, buble, sucrose, etc) (see https://github.com/unifiedjs/unified/issues/34#issuecomment-364196553).
Transpiling dependencies for IE is something that could be covered in a guide https://github.com/unifiedjs/unifiedjs.github.io/issues/7
Which is obviously an anti-pattern because I'm compiling the package in node_modules
Transpiling dependencies is not an anti pattern. It is supported by webpack, rollup, create-react-app, and vue-cli because it is a common need, especially when IE support is a requirement.
PRs adding documentation and guides are welcome!
Sounds good! I just created a super simple guide for it. Wonder if you'd like to accept it :)
The dependency "is-plain-obj" npm package is not compatible with ...... IE
tl;dr is-plain-object seems like a good alternative.
Unlike other packages, "is-plain-obj" is publishing arrow functions without transpiling. It will cause the applications that use IE as the javascript engine failing to load unifiedjs. For my case, it's on-premise MS Word 2019. In addition, although "is-plain-obj" is a 4 line function, it's claiming to support node8+ only. I believe unifiedjs is aiming to support both browser and backends, so a backend only package might not be a good dependency.
FYI, my use case is writing a text processor as an Add-on for MS Word with typescript and unified. My current workaround is using babel to load this package first in my webpack.config.js. Which is obviously an anti-pattern because I'm compiling the package in node_modules
Your environment
Steps to reproduce
Then see syntax error from is-plain-obj
Expected behaviour
unifiedjs should load correctly
Actual behaviour
The 'is-plain-obj' npm package contains ES6 syntax