Eslint-plugin-import: webpack aliases don't work

Created on 14 Jun 2016  路  5Comments  路  Source: benmosher/eslint-plugin-import

I have a file structure like this:

app/
  components/
    FooBar.js
  utils/
    generateHtmlId.js

and in webpack I have:

const modules = [
  'app',
  'node_modules',
];

[...]

resolve: {
    modulesDirectories: modules,
    modules,
    extensions: [
      '',
      '.js',
      '.jsx',
      '.react.js',
      '.json',
    ],
    alias: {
      // required for enzyme to work properly
      sinon: 'sinon/pkg/sinon',
      app: path.join(process.cwd(), 'app'),
    },
  },

Inside FooBar.js I have:

import genId from 'utils/generateHtmlId';

But this plugin throws an error saying that the path can't be resolved.
Note that webpack compiles everything properly.

Most helpful comment

I don't think the problem is there because I had the same problem even with 1.8.1

All 5 comments

what version of the plugin is installed? npm ls | grep eslint-plugin-import + npm ls | grep eslint-import-resolver

[email protected]
[email protected]
[email protected]

If it can helps, I started with react-boilerplate

Configuration of the Webpack resolver is broken in 1.9.0, use latest (1.8.1). I should really yank it. :-(

I don't think the problem is there because I had the same problem even with 1.8.1

@FezVrasta This doesn't look like it got fixed. I'm still encountering the error with ^1.16.0

Was this page helpful?
0 / 5 - 0 ratings