1

I have been using jspm and want to test out using Webpack.

I have followed this tutorial.

However, when I run the example, the js errors on

 import _ from 'lodash'; 

Is there a different way I should be writing this import statement? Should I use a transpiler on it to turn it into a require statement?

4
  • "Should I use a transpiler on it to turn it into a require statement?" If you are using webpack 1.x then yes. Commented Dec 15, 2016 at 16:59
  • Ah, yes, am using 1.14 Commented Dec 15, 2016 at 17:05
  • 1
    You can also try webpack 2 which supports ES6 modules. Commented Dec 15, 2016 at 17:05
  • @FelixKling, if you want to post an answer, I will accept. Commented Dec 15, 2016 at 17:12

1 Answer 1

1

Webpack 1 doesn't support ES6, so yes, in that case you have to use a transpiler.

Webpack 2 supports ES6 and can perform advanced optimizations when working with ES6 modules, but you might still need a transpiler if you use other ES6 features that are not supported by the environment you want to executed the code in.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.