2017-01-05 3 views
0

포함 할 webpack이있는 .coffee 파일이 있습니다. 난 아직이 같은 라인에 대한 import/no-unresolved linting 오류를 얻을 수 있습니다,하지만 어떤 이유eslint webpack resolver가 작동하지 않습니다.

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

:

// 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 파일을 설정 한 :

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

여기에는 my-coffee-file.coffee 디렉토리가 있습니다.

무엇이 잘못 됐는지에 대한 아이디어가 있습니까?

답변

1

내 문제는 내 프로젝트의 디렉토리 구조 때문이 ...

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

은 그래서 명시 적으로 웹팩 설정 파일을 가리 키도록 필요한 :

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

../이 필요 그것 때문에 내가 frontend 디렉토리 안에 살고있는 package.json을 찾으면 검색을 시작합니다.

관련 문제