Q:

use import via npm, do I need compiler? 

I am just curious, I installed jquery via npm locally, and created HTML code below
<body>
 <script>
    import jquery from "jquery";
 </script>
</body>

but it got error. 
my browser is chrome v65 https://caniuse.com/#feat=es6-module The import is supported and doesn't need compiler

A:

You have to add the type="module" attribute on the <script> tag or else it won't know that you're trying to include ES6 modules.  You do this by:
<script type="module">
</script>

Then the jQuery module from npm doesn't export anything by default, so you have to import the whole file like so:
<script type="module">
  import './node_modules/jquery/dist/jquery.min.js'
</script>

So I'm importing everything from the jQuery file.  Then what we get is the variable jQuery and the variable $ assigned to the global window var.