3

In the code sample below, why does the commented line not work to import marked? I'm using the https://github.com/shama/es6-loader

module $ from 'jquery';
module React from 'react';

//import { marked } from 'marked';
var marked = require("marked");

Here's a sample repository: https://github.com/justin808/react-tutorial-hot/tree/es6

This demo shows: 1. Webpack and hot-reload 2. React 3. ES6

Andreas Köberle
  • 106,652
  • 57
  • 273
  • 297
justingordon
  • 12,553
  • 12
  • 72
  • 116
  • Possible duplicate of [How can I use ES6 in webpack.config.js?](https://stackoverflow.com/questions/31903692/how-can-i-use-es6-in-webpack-config-js) – meza Oct 23 '17 at 21:34

2 Answers2

6

You're using the destructuring operator which won't work if there is nothing to destructure, i.e. marked exports a function.

import marked from 'marked' should work though.

prayerslayer
  • 883
  • 9
  • 13
0

The es6-loader uses the es6-module-transpiler which states that

The ES6 module syntax is still undergoing a lot of churn, and will likely change before final approval.

Maybe the described syntax is not supported yet?

Johannes Ewald
  • 17,665
  • 5
  • 44
  • 39