2017-01-05 11 views
0

webpackに含めるように設定したファイルがあります。.coffeeがあります。eslint webpackリゾルバが動作しない

// inside `webpack.config.js`... 

resolve: { 
    // tell webpack which extensions to auto search when it resolves modules. With this, 
    // you'll be able to do `require('./utils')` instead of `require('./utils.js')` 
    extensions: ['', '.js', '.coffee', '.jsx'], 
    // by default, webpack will search in `web_modules` and `node_modules`. Because we're using 
    // Bower, we want it to look in there too 
    modulesDirectories: ['node_modules', 'bower_components'], 

    alias: { 
    'jquery.ui.widget': 'jquery-ui/ui/widget.js', 
    'jquery-ui/widget': 'jquery-ui/ui/widget.js', 
    'jquery-ui-css': 'jquery-ui/../../themes/base' 
    } 
}, 

私はeslint-import-resolver-webpack私のプロジェクトにインストールされ、そして私の.eslintrc.jsonファイルでそれを設定している:何らかの理由で

"settings": { 
    "import/parser": "babel-eslint", 
    "import/resolver": { 
     "webpack": { "config": "webpack.config.js" } 
    } 
}, 

しかし、私はまだこのようなラインのimport/no-unresolvedリンティングエラーを取得します:

import foo from './my-coffee-file' 

ここにディレクトリ内にmy-coffee-file.coffeeがあります。

何が問題になっているかについてのアイデアはありますか?

答えて

1

私の問題は、だから私は明示的にWebPACKの設定ファイルを指すように必要な...

config 
|__webpack.config.js 
| 
frontend 
|__package.json 
|__all the JS/coffee files 

私のプロジェクトのディレクトリ構造によるものであった。なぜなら、それ

"settings": { 
    "import/resolver": { 
     "webpack": { "config": "../config/webpack.config.js" } 
    } 
} 

../する必要があります私にとってはfrontendディレクトリの中に住んでいるpackage.jsonが見つかったところで検索が始まります。

関連する問題