Native js uses es6 import to introduce error reporting

  1. originally wrote the project using vue-cli, and wrote a native js demo, that reported an error when it was introduced
  2. exposure mode

    var uploadPath = "hello world!";
    
    export {uploadPath}
  3. introduction method

    <script type="text/javascript">
      import {uploadPath} from "../../common/js/global";
    </script>
  4. error

    clipboard.png

  5. if it is said that ES6 is not recognized, then import should have reported an error, and vue-cli should have already configured webpack. May I ask you what kind of problem this is?
Nov.10,2021

scrpit type type="module"

browsers do not support import, without import error reporting because there is also a dynamic import
webpack environment that supports import code
[write a project using vue-cli and write a demo of native js]?

Menu