I'm getting errors on local modules.
Using the following to start my application:
"start": "NODE_PATH=\\"$(pwd)\\" node -r babel-register -r babel-polyfill src/index.js",
By setting NODE_PATH
to the root directory where package.json
lies enables me to write imports from the root:
import config from 'src/utils/config';
This is annoying the import/no-extraneous-dependencies
rule. If I write the relative path it doesn't complain. Is there a way for eslint
to recognize the root directory as the starting path for module import paths?
This looks like you're doing a mistake. Shouldn't that be import config from './src/utils/config'
? Otherwise I'd expect it tries to get a package named 'src' from npm, and if successful, it would then go into subfolders within that package.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.