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

feat: support custom loginfo with server mode #520

Merged
merged 5 commits into from Aug 17, 2022

Conversation

southorange0929
Copy link
Contributor

Sometimes,i will set host to be 0.0.0.0,but i won't console info with 0.0.0.0.So i need to custom log info and show better info for users.

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 16, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@valscion
Copy link
Member

Hi, thanks for the pull request! How are you intending to use this change in your application?

@southorange0929
Copy link
Contributor Author

Actually, i create a cli tool for my team.

example for use

const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
// webpack.config.js
plugin: [
  new  BundleAnalyzerPlugin({
    host: '0.0.0.0',
    logInfo: () => {
      // some other logic
      return 'custom log info';
    }
  })
]

I will add analytics in cli tool. If i can use it like this demo.I think it's fine

src/utils.js Outdated Show resolved Hide resolved
@valscion
Copy link
Member

copy that! I fixed. Any other suggestions?

If you could add a changelog entry to CHANGELOG.md then I think this is OK. You will also need to sign the CLA like the bot commented above:

#520 (comment)

@southorange0929
Copy link
Contributor Author

copy that! I fixed. Any other suggestions?

If you could add a changelog entry to CHANGELOG.md then I think this is OK. You will also need to sign the CLA like the bot commented above:

#520 (comment)

OK,i finished!

@valscion
Copy link
Member

OK so the usage could look something like this, right?

plugins: [
    new  BundleAnalyzerPlugin({
      analyzerUrl: ({ listenPort, listenHost, boundAddress }) => {
        return `http://some-domain.example.com:${boundAddress.port}`;
      }
  })
]

Can we add a short documentation to the README.md about this option, too? https://github.com/webpack-contrib/webpack-bundle-analyzer#options-for-plugin

It could be below the analyzerPort value there.

Name: analyzerUrl
Type: {function}, called with { listenHost: string, listenHost: string, boundAddress: server.address}. server.address comes from Node.js
Default: http://${listenHost}:${boundAddress.port}. The URL printed to console with server mode

@southorange0929
Copy link
Contributor Author

Alright, it's my first time to contribute to this project and thanks for your guide.Thanks a lot :)

@valscion
Copy link
Member

Thank you for your contributions ☺️ this PR seems good to go to me, hopefully it be useful to others, too ☺️

@valscion valscion merged commit 16d8e07 into webpack-contrib:master Aug 17, 2022
@valscion
Copy link
Member

This has now been released in v4.6.0 ☺️

crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Aug 23, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer) | devDependencies | minor | [`4.5.0` -> `4.6.0`](https://renovatebot.com/diffs/npm/webpack-bundle-analyzer/4.5.0/4.6.0) |

---

### Release Notes

<details>
<summary>webpack-contrib/webpack-bundle-analyzer</summary>

### [`v4.6.0`](https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/HEAD/CHANGELOG.md#&#8203;460)

[Compare Source](webpack-contrib/webpack-bundle-analyzer@v4.5.0...v4.6.0)

-   **New Feature**
    -   Support outputting different URL in server mode ([#&#8203;520](webpack-contrib/webpack-bundle-analyzer#520) by [@&#8203;southorange1228](https://github.com/southorange1228))
    -   Use deterministic chunk colors (#[501](webpack-contrib/webpack-bundle-analyzer#501) by [@&#8203;CreativeTechGuy](https://github.com/CreativeTechGuy))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xNjUuMSIsInVwZGF0ZWRJblZlciI6IjMyLjE2NS4xIn0=-->

Co-authored-by: cabr2-bot <cabr2.help@gmail.com>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1513
Reviewed-by: Epsilon_02 <epsilon_02@noreply.codeberg.org>
Co-authored-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
Co-committed-by: Calciumdibromid Bot <cabr2_bot@noreply.codeberg.org>
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.

None yet

2 participants