使用带有WebPack的ES6模块,为什么还需要

Using ES6 modules with WebPack, why require still needed

本文关键字:为什么 模块 ES6 WebPack      更新时间:2023-09-26

在下面的代码示例中,为什么注释行不能导入标记?我正在使用https://github.com/shama/es6-loader

module $ from 'jquery';
module React from 'react';
//import { marked } from 'marked';
var marked = require("marked");

以下是一个示例存储库:https://github.com/justin808/react-tutorial-hot/tree/es6

此演示显示:1.Webpack和热重新加载2.反应3.ES6

您使用的是析构函数运算符,如果没有任何可析构函数,即marked导出函数,则该运算符将不起作用。

import marked from 'marked'应该可以工作。

es6加载程序使用es6模块转发器,该转发器声明

ES6模块语法仍在经历大量的变动,在最终批准之前可能会发生变化。

也许所描述的语法还不受支持?