Npm releases ES6 module and then introduces it. Error in import?

  node.js, question
D:\iota\code\web\iota-api-server-scaffold\node_modules\iota-user\index.js:4
 import * as auth from './src/auth';
 ^^^^^^
 SyntaxError: Unexpected token import
 at Object.exports.runInThisContext (vm.js:53:16)
 at Module._compile (module.js:513:28)
 at Module._extensions..js (module.js:550:10)
 at Object.require.extensions.(anonymous function) [as .js] (C:\Users\35824\AppData\Roaming\npm\node_modules\babel-cli\node_modules\babel-register\lib\node.js:166:7)
 at Module.load (module.js:458:32)
 at tryModuleLoad (module.js:417:12)
 at Function.Module._load (module.js:409:3)
 at Module.require (module.js:468:17)
 at require (internal/module.js:20:19)
 at Object.<anonymous> (config.js:10:1)

图片描述

Npm set registry local warehouse
Npmadduser-registry local warehouse
npm publish

Babel for compilation,
I suspect that the node_modules of the module inside are not recognized after being introduced.
So is the way I issue it wrong, or do I need any command conversion?

  1. “babel for compilation” refers to a class library projectiota-user, or the project currently referencing the class libraryiota-api-server-scaffold?

  2. iota-userProjectpackage.jsonInside’smainWhat file does the field refer to?babelIs it compiled or is it the source file before the compiler?

I suggest you read it completely first.package.json, and then also give you a reference project:angular-baidu-map. My source code is to usees6Written, passedWebpack plus babelCompile innpmPublish the compiled file.mainField pointingdist/angular-baidu-map.js(compiled file).

When others are therebabelOr other supportES6Under the compiling environment of module specification, it can be usedimport {ngBaiduMap} from 'angular-baidu-map';To quote my module