After using babel to support es6's import in NodeJS, importing axios failed?

first of all, import is not supported before Node 9. I made it possible to use import, in Node by introducing "babel-cli" and" babel-preset-es2015", but I still had a problem when importing axios. I didn"t add a path when I import, which is similar to require:

.

clipboard.png

import frommodule:

clipboard.png

:

clipboard.png

what is the reason for the failure of import in my project? Do you need to configure webpack?


I made it possible to use import in Node by introducing 'babel-cli'' and 'babel-preset-es2015'.

then the browser will report an error, saying that import from must be a path (it imports module according to the path):

the server supports import . Isn't it strange that the browser reports an error?
browser import requires a path, but in most cli , the node_modules directory is configured in webpack .


closed case ~

still requires webpack. Configure webpack to automatically import dependent module

The second way to write the

question is to rely on webpack to import axios, similar to require in node.
the first method is the modular import of the es6 standard in the browser, which is imported according to the path of module.

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