Closed jameschenjav closed 6 years ago
Got it, thanks for your detailed report and I will reproduce and fix the bug as soon as possible.
赞
@jameschenjav I create a project to reproduce the bug according to your description but everything works fine. My development environment is node: v6.10.2
, npm: 3.10.10
. Here is the project resolver-alias-debug. You can clone it and try again. If you reproduce the bug, let me know.
不好意思,的确是无法重现这个错误了……想不起来最近有动过什么,最近换了 nvm,unlink 了原来的 npm/npx,但是也记不清是不是这俩礼拜的事儿了,而且理论上也不应该会有影响。
没关系,有问题欢迎再提出来 😊
I face a similar issue, but in my case, the error occurs only if the path has only one level depth.
For example,
import { foo, bar } from '@test' // cannot find module '@test'. ts(2307)
import { foo, bar } from '@test/index' // work!!
p.s. I use typescript, not sure if this related
@Lpaydat this happens to me as well, did you manage to fix it?
Any news on this?
Eslint complains about
index.js
under aliased foldersimport/no-unresolved
.For exp, I have folder
utils
under the path@
, it contains a lot of files andindex.js
to export everything.Anything else like
which is a folder and contains
index.js
works fine.Also my
webpack
works fine with same settings:module.exports = { root: true, parserOptions: { parser: 'babel-eslint' }, env: { browser: true, }, extends: ['plugin:vue/essential', 'airbnb-base', 'plugin:lodash/recommended'], plugins: [ 'vue', 'lodash', 'lodash-fp', ], settings: { 'import/resolver': { alias: { extensions: ['.js', '.vue', '.json'], map: [ ['@', path.resolve(__dirname, './packs')], ], }, }, }, rules: { 'import/extensions': ['error', 'always', { js: 'never', vue: 'never' }], 'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: [ 'state', // for vuex state 'acc', // for reduce accumulators 'e' // for e.returnvalue ] }], 'import/no-extraneous-dependencies': ['error', { optionalDependencies: ['test/unit/index.js'] }], 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', } }