When babel is compiled, it is prompted that the value of import cannot be read.

The

directory structure is as follows

Code
profile.js

function showMsg(msg) {
    alert(msg);
}
export default {showMsg};

import.js

import {showMsg} from "./profile.js";

showMsg("hello world");

.babelrc

{
    "presets":[
        "es2015"
    ],
    "plugins":["transform-es2015-modules-umd"]
}

package.json

{
  "name": "module",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "babel src/import.js -o dist/index.js"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-plugin-transform-es2015-modules-umd": "^6.24.1",
    "babel-preset-es2015": "^6.24.1"
  }
}

prompt Cannot read property "showMsg" of undefined after running

Apr.01,2021

profile.js

function showMsg (msg) {

alert(msg);

}
export {showMsg};

Delete default

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-1eac425-20bc.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-1eac425-20bc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?