意外的令牌import-lodash导入

时间:2018-01-04 02:18:07

标签: javascript ecmascript-6 handlebars.js lodash

在我探索plop微型发电机时,我遇到了上述错误, 代码如下:

import {trimRight, isEmpty} from 'lodash'


const ensurePlural = ( text ) => trimRight( text, "s" ) + "s";

const isNotEmptyFor = ( name ) => {
  return ( value ) => {
    if ( isEmpty( value ) ) return name + " is required";
    return true;
  }
}

..... ... 当我运行npm run plop时,我得到以下内容

(function (exports, require, module, __filename, __dirname) { import {trimRight, isEmpty} from 'lodash'
                                                              ^^^^^^
SyntaxError: Unexpected token import

0 个答案:

没有答案