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

fix options.dir can not work issue #7

Closed
wants to merge 1 commit into from

Conversation

njleonzhang
Copy link

control output path by options.dir

function generateBundle(options, rendered) {
const dir = options.dir || dirname(options.dest || options.file);
function generateBundle(bunldeOptions, rendered) {
const dir = options.dir || dirname(bunldeOptions.dest || bunldeOptions.file);
Copy link
Owner

Choose a reason for hiding this comment

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

This appears to be equivalent?

Copy link
Author

@njleonzhang njleonzhang Oct 8, 2019

Choose a reason for hiding this comment

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

use bunldeOptions to prevent options params of createFilter not be override by generateBundle, so that options.dir can be correct.

Copy link
Owner

Choose a reason for hiding this comment

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

Ah I see, this is potentially a variable shadowing issue. I misread before. 🤔

You actually want the local options: OutputOptions param here. The outer options variable is the plugin options.

The naming/shadowing is definitely confusing here. I will change those.

I don't think there's a bug here, though. Could you add a failing test case to demonstrate the issue?

Copy link
Author

Choose a reason for hiding this comment

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

if we don't rename the inner option to another name, options.dir can not be assign to const dir correctly, which make user cannot set output's path.

Copy link
Owner

Choose a reason for hiding this comment

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

This plugin does not provide a plugin level option dir. That is configured via your rollup config, which comes from the options param passed to generateBundle by rollup.

This plugin currently only writes files to the rollup output directory, no option for a configurable subdirectory is provided. Is that what you are looking for?

@bspaulding bspaulding closed this Oct 1, 2019
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.

2 participants