Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack resolver doesn't apply resolve.root and externals option. #299

Closed
ellemedit opened this issue May 3, 2016 · 9 comments
Closed

Comments

@ellemedit
Copy link

ellemedit commented May 3, 2016

My webpack configurations is

// config.js
export webpackCommon = {
  // ...,
  resolve: {
    root: srcPath, // it's /src directory path
    extensions: ['', '.jsx', '.json', '.js'],
  },
  externals: [
    /^\.\/assets\.json$/,
    fs.readdirSync(modulePath).filter(x => x !== '.bin'),
  ],
  // ...,
};
// config.es5.js
require('babel-register');
require('babel-polyfill');
module.exports = require('./config').webpackCommon;

My eslintrc setting is:

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

OS: OSX El Cap latest

this plugin can't resolve ./assets.json
2016-05-03 2 40 59

and root path modules as below:
There's two directories

  • /src/components/A
  • /src/components/B

In component A, it can resolve component B as import B from 'component/B; but it doesn't work.

@benmosher
Copy link
Member

From your .eslintrc:

"config": "./tools/conifg.es5.js"

is that a typo in the issue or a typo in your config?

@benmosher benmosher mentioned this issue May 3, 2016
@ellemedit
Copy link
Author

@benmosher that's my configuration.

@benmosher
Copy link
Member

So what happens if you update 'conifg' to 'config'?

@ellemedit
Copy link
Author

ellemedit commented May 5, 2016

@benmosher I can't get what you mean.

@benmosher
Copy link
Member

Your Webpack config path is misspelled in the resolver config.

@ellemedit
Copy link
Author

@benmosher The path is correct. because I can reference the es5 configurations through using node-cli like:

console.log(require('./tools/config.es5.js'));

the configuration files are placed at <Project Root>/tools.

@benmosher
Copy link
Member

I get that, but "config" is misspelled as "conifg" in the eslintrc you pasted.

@ellemedit
Copy link
Author

ellemedit commented May 5, 2016

Wow... awesome... I couldn't find out... Thank you. This issue can be closed.

@benmosher
Copy link
Member

Thus #300. No worries. 😎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants