javascript modules and CORS

后端 未结 2 1100
陌清茗
陌清茗 2020-12-01 23:50

I am trying to understand modules in JavaScript but when I try to write a very simple module I get CORS error.I am using bracket as my text editor and the odd part is when I

相关标签:
2条回答
  • 2020-12-01 23:59

    If you have node installed I would recommend installing http-server package. You'll be up and running in no time! Fixed my problem and I can run my application in chrome using the server.

    0 讨论(0)
  • 2020-12-02 00:00

    Many browsers do not allow you to access files on the local filesystem with JavaScript (even if the HTML document is also on the local filesystem).

    This extends to loading JavaScript modules.

    Install a webserver and use that (with a URL like http://localhost/) for testing.

    0 讨论(0)
提交回复
热议问题