How do I cache bust imported modules in es6?

后端 未结 7 1011
梦谈多话
梦谈多话 2021-01-31 09:21

ES6 modules allows us to create a single point of entry like so:

7条回答
  •  醉梦人生
    2021-01-31 09:40

    Use of relative path works for me:

    import foo from './foo';
    

    or

    import foo from './../modules/foo';
    

    instead of

    import foo from '/js/modules/foo';
    

    EDIT

    Since this answer is down voted, I update it. The module is not always reloaded. The first time, you have to reload the module manually and then the browser (at least Chrome) will "understand" the file is modified and then reload the file every time it is updated.

提交回复
热议问题