-
-
Notifications
You must be signed in to change notification settings - Fork 179
Legal, License, Copyright comments should not be removed by default #222
Comments
Interestingly, the correct legal comments are successfully extracted when adding new UglifyJSPlugin({
sourceMap: true,
extractComments: true
}) Strange, that the comments are not preserved in the bundle itself. |
@jnachtigall Seems bug. Thanks for issue. PR welcome! |
Is there any way to "downgrade" or similar in the meantime? I'd like to upgrade to Webpack v4, but I can't without license comments. |
@julmot tomorrow i fix this or you can do PR 👍 |
Done in #250 |
Released in |
Thanks @michael-ciniawsky So when does this come into Webpack itself? I'm not directly depending on this plugin: |
@julmot already in |
Hi, I've been trying to follow the documentation and a few of the issues here, and I'm not sure this is actually working.
Shouldn't this in theory keep all comments and save them to the external file? my package.json uses:
|
@andrevenancio remove all options |
Hey @evilebottnawi then I might be doing something wrong. cause I've been trying different options and so far no luck.. I've even went to my node_modules and comment the shit out of Here's my code: https://github.com/andrevenancio/license-example/blob/master/webpack.production-2.js |
We've been trying to help fix an issue on gl-matrix (toji/gl-matrix#304) and hence my tests |
@andrevenancio what you want remove all comments or leave legal comments? |
Yeah, sorry I've been explaining this poorly. Yeah I'm expecting to scrap all the comments except the ones tagged with The idea is to strip every comment except the license from our gl-matrix repo. |
@andrevenancio i.e. only with |
You can avoid set |
Use |
Still no luck. If I use the function and log the comments I can see a bunch of comments coming through (mainly the comments used to generate the docs (from node_modules/gl-matrix), However if I try to use the regexp to validate the comment the regexp fails and no comment is added
|
@andrevenancio just put here what you comments you have and what comments should be left and should be strip. |
This are the comments I've been trying to test against. https://github.com/andrevenancio/license-example/blob/master/src/index.js None of them pass the regexp. |
@andrevenancio looks like problem in uglify (i wrote about this above) |
I see... so its just a matter of waiting for uglify to resolve the bug you posted and hopefully then you'll update |
@andrevenancio i think this bug never was solve due in arch problem inside uglify ast parser, but if they fixed, you need only update deps and lock file, I would suggest that you try switch to |
still bug |
So, I have to write license info by hands?1. src/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description HC
* @augments
* @example
*
*/
(function(){
doSomething();
})();
2. target
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description HC
* @augments
* @example
*
*/
!function(){doSomething();} 3. result
!function(){doSomething();} |
Uglify still does not respect the I tried This is the extract of the webpack configuration: const webpackConfig = merge(baseWebpackConfig, {
mode : 'production',
module : {
rules: [ // Only activate the linting when building for the production
{
test : /\.js$/,
loader : 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test')],
options: {
formatter: require('eslint-friendly-formatter'),
},
},
],
},
optimization: {
minimizer : [
new UglifyJsPlugin({
cache : true,
parallel : true,
sourceMap : true,
uglifyOptions: {
nameCache: {},
ie8 : false,
safari10 : true,
compress : { // see https://github.com/mishoo/UglifyJS2#compress-options
dead_code : true,
drop_debugger: true,
keep_fnames : false,
passes : 4,
},
output : { // See https://github.com/mishoo/UglifyJS2#output-options
beautify: false,
comments: 'some',
},
mangle : { // see https://github.com/mishoo/UglifyJS2#mangle-options
keep_fnames: false,
toplevel : true,
},
}
}),
],
},
devtool: '#source-map',
output : {
libraryTarget: 'umd',
library : 'AutoNumeric',
filename : 'autoNumeric.min.js',
path : resolve('dist'),
},
plugins: [],
}); Could you please re-open that bug? |
@AlexandreBonneau we just wrapper around |
Steps to reproduce:
Version in
package.json
:My
webpack.config.js
:Now in the
./src/components/app.js
there are several 'vendor' libraries imported like:import $ from 'jquery';
Actual results:
When running
npm run build
which creates a uglified minimal bundle, then all comments are stripped.For instance,
jquery
has this header which is not present any more in the uglified bundle:Expected results:
Legal copyright comments should not be stripped by default. The comment at webpack/webpack#324 (comment) points out, that
At the moment this is not the case: By default all comments are stripped at the moment.
The text was updated successfully, but these errors were encountered: