Why do import other js compilers in js files not report errors and browsers report errors?

beginners of vue, do not want to use vue-cli and webpack, but the introduction of vue.js will report errors, and there are also dependencies in package. The compiler does not report errors, but the browser reports Uncaught SyntaxError: Unexpected identifier

.




webstorm

js Code:

import Vue from "vue"
import Resource from "vue-resource"
import {AsyncComponent as reject } from "vue"
import {AsyncComponent as resolve} from "vue"
Vue.use(Resource);
var vm = new Vue({
    el: "-sharpapp",
    data: {
        adminName:"",
        password:"",
        message:"",
        url:"localhost:8080/ssm/admin/find",
        id:1
    },
    methods: {
        submit: function () {
            this.message="";
            var params=new Object();
            params.name=this.adminName;
            Vue.http.get(
                this.url,
                {
                    params: params
                },
                {emulateJSON: true}
            )
                .then((success) => {
                    resolve(success);
                })
                .catch((error) => {
                   reject(error);
                });
        }
    }
});
Jan.18,2022

adding an attribute to the script tag in the

index.html file solves
type= "module"

<script type="module" src=""></script>

teacher Ruan wrote
link description

in her article.

what is your compiler? Code editor? IDE? That's code recognition. Browsers haven't implemented the import keyword yet, so let's be honest with webpack. If you don't want to use webpack, use babel-cli to convert it to es5


.

landlord, if you don't want to use webpack, you need to introduce the js file of UMD mode.

import Vue from 'vue';
//  vue.runtime.common.js
//  CMD 
//  UMD vue.js  vue.min.js
//  html : https://unpkg.com/vue@2.5.17/dist/vue.js

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c142-2c312.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c142-2c312.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?