[英]How to import with ECMAScript (vanilla javascript) with modules es6
I read this post and i want use D3.js (v4+) using only import statement like this: 我读了这篇文章 ,我想使用D3.js(v4 +)只使用这样的import语句:
import { selection } from '../node modules/d3/build/d3.js';
But, because code output is UMD (or read this ) and can't import because some globals is no defined, and ES6 can't resolve absolutive names in node_modules
for example and vanilla don't suport import statement without extension like this: 但是,因为代码输出是UMD (或读取此内容 )并且无法导入,因为某些全局变量未定义,并且ES6无法解析node_modules
绝对名称,例如vanilla不支持导入语句而没有扩展名,如下所示:
import * as someFeature from './myAwesomeModule';
And this is pattern to import modules and each day is growing up like you see here . 这是导入模块的模式,每天都在成长, 就像你在这里看到的那样 。
How i can use import statement without any plugin today? 今天如何使用import语句而不使用任何插件?
You can import d3 like this: 您可以像这样导入d3:
import * as d3 from 'd3';
See more here: https://github.com/d3/d3/blob/master/README.md#installing 在此处查看更多信息: https : //github.com/d3/d3/blob/master/README.md#installing
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.