简体   繁体   中英

Using a standalone ES6 module in IE11

I have a small ES6 module I wrote that needs to now be integrated into a project that has to support IE11. The rest of the project is written in ES5 and ideally I'd like to just transpile my module and import it as a Script in the project's HTML and have the value it exports attached to the window object.

I've tried a few different configurations for babel but they all seemed to be geared towards transpiling a complete bundle of code or required importing polyfills into the original module (which currently has no dependencies), but nothing seems to be compatible with IE11.

Module structure:

const MyModule = (() => {
    const moduleStuff = {}
    function moduleLogic(params) {
          doStuff(params)
    }

    return {
        init: initParams => doStuff(initParams),
        moduleMethod: moduleData => {
            doStuff(moduleMethod)
        }
    }
})();

export default MyModule;

Not intended to be an answer, but with the link is too long for a comment.

With the typo removed, seems to look fine to me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM