-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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(minify): set the default value of esbuild's legalComments option to external #18104
base: main
Are you sure you want to change the base?
Conversation
Run & review this pull request in StackBlitz Codeflow. |
I think
I think we don't need an option for that. I don't think there're any cases where you need to specify the filename. I wonder if we should add a new |
generateBundle(options) { | ||
if (collectLegalComments.length && options.dir) { | ||
this.emitFile({ | ||
fileName: 'LEGAL.txt', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to use name: 'LEGAL.txt'
instead so that the file name includes a hash. That requires the res.code += '\n/*! For license information please see LEGAL.txt */'
to be moved into generateBundle
hook.
expect(jsContent).toContain( | ||
'/*! For license information please see LEGAL.txt */', | ||
) | ||
expect(cssContent).not.toContain('/*! explicit comment */') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to add /*! For license information please see LEGAL.txt */
to the CSS as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable.
Sorry that it took a while. In the last meeting, we discussed about this PR. We would like to provide a more complete license file extraction for the builtin feature. Packages published in npm often does not contain license comments, but commonly has a license file linked from the |
Fixes #17892
According to the issue, legal comments from files are split into a separate file by default. However, I have a few questions:
Should
external
be the default value oflegalComments
?All comments are output to a file named
LEGAL.txt
, but should there be an option to specify the output path/filename?