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

Add addModulesDirectories config #256

Merged
merged 2 commits into from
Dec 16, 2016
Merged

Add addModulesDirectories config #256

merged 2 commits into from
Dec 16, 2016

Conversation

neezer
Copy link
Contributor

@neezer neezer commented Dec 10, 2016

Allows appending to the default list of modules directories. I picked a name that I think sounds good, but happy to change it if y'all have something else you'd prefer. 😄

Relevant discussion: #195

@RyanZim

Allows appending to the default list of modules directories.

Relevant discussion:

#195
@michael-ciniawsky
Copy link

Maybe we could refactor options.resolve for that , instead of adding it to options directly?

let resolveOpt = {} // defaults

if (typeof options.resolve === 'object') {
   resolveOpt = Object.assign(resolveOpt, options.resolve)
   resolveOpt.moduleDirectories.push('node_modules', 'web_modules')
}

if (typeof options.resolve === 'function') {
  // Use custom resolver
}

@neezer
Copy link
Contributor Author

neezer commented Dec 11, 2016

Neat, @michael-ciniawsky! Happy to change the PR to this approach.

@RyanZim @MoOx Any preference?

@RyanZim
Copy link
Collaborator

RyanZim commented Dec 13, 2016

@michael-ciniawsky I like that idea, I just think using the resolve option is rather implicit behavior.

If we go that direction, we should set root, and path in the same object as moduleDirectories.

For right now, I would be in favor of just doing it the way it is done in this PR. For the next major version, I would consider removing root, path, and addModuleDirectories, in favor of a single resolveOpts option; bikeshed about that later.

Copy link
Collaborator

@RyanZim RyanZim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, except for the comment below.

Type: `Array`
Default: `[]`

An array of folder names to add to [Node's resolver](https://nodejs.org/api/modules.html#modules_loading_from_node_modules_folders).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should link to https://github.com/substack/node-resolve instead, since that is the module that is actually used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RyanZim Updated!

@RyanZim RyanZim requested a review from ai December 13, 2016 23:59
@RyanZim
Copy link
Collaborator

RyanZim commented Dec 14, 2016

@ai Thoughts? @MoOx Any objections?

@RyanZim RyanZim merged commit 028663b into postcss:master Dec 16, 2016
@RyanZim
Copy link
Collaborator

RyanZim commented Dec 16, 2016

@neezer Thanks!

@renatorib
Copy link

It's not published yet?

@RyanZim
Copy link
Collaborator

RyanZim commented Jan 10, 2017

@renatorib It's not. I should publish it. I was planning on adding a few other things to the next release, but I haven't got around to it, so I guess I'll just publish this. I'll comment here as soon as I get it done.

@RyanZim
Copy link
Collaborator

RyanZim commented Jan 10, 2017

@renatorib @neezer Released: https://github.com/postcss/postcss-import/releases/tag/9.1.0. Sorry for the long wait.

@neezer
Copy link
Contributor Author

neezer commented Jan 10, 2017

@RyanZim Great! So should #195 be closed now?

@RyanZim
Copy link
Collaborator

RyanZim commented Jan 10, 2017

@neezer Yep, thanks.

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

Successfully merging this pull request may close these issues.

5 participants