Closed tstibbs closed 3 years ago
Try adding skipChildCompilers: true
to license-webpack-plugin and see if that makes a difference?
Well... that does get rid of the warnings, but it also loses three licences from the output file (out of about 53). For my project, the libraries that end up missing from the licenses.txt file are: html-webpack-plugin, css-loader, font-awesome. I'm not quite sure why it's affecting those modules and not others.
If it helps you can see my configuration in context (without the change you suggested above) here: https://github.com/tstibbs/geo-bagging/blob/master/ui/webpack.config.cjs#L86. The file generated (again, without the change you suggested above) can be seen here: https://github.com/tstibbs/geo-bagging/blob/gh-pages/licenses.txt
For me, it got rid of css-loader
(which would be ideal, because it isn't included in the bundle), but got rid of dependencies incuded via CSS (typeface-open-sans).
I have tried to enable html webpack plugin, css-loader and font-awesome on a sample project but could not recreate the error message. If I could get a minimal test case for this it would help.
The following is the smallest I can come up with. To reproduce the warning it should be sufficient to do npm install && npm run build
.
Adding skipChildCompilers
does get rid fo the error, but also causes the css-loader
licence to be missed from the licenses.txt.
==============================
app.js:
import 'leaflet.locatecontrol/dist/L.Control.Locate.min.css'
import 'sidebar-v2/css/leaflet-sidebar.css'
==============================
webpack.config.js:
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const LicenseWebpackPlugin = require('license-webpack-plugin').LicenseWebpackPlugin
module.exports = {
entry: './app.js',
plugins: [
new MiniCssExtractPlugin(),
new LicenseWebpackPlugin({
perChunkOutput: false
})
],
module: {
rules: [
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader']
}
]
}
}
==============================
package.json:
{
"private": true,
"devDependencies": {
"css-loader": "^4.2.2",
"license-webpack-plugin": "^2.3.0",
"mini-css-extract-plugin": "^0.11.0",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12"
},
"dependencies": {
"leaflet.locatecontrol": "^0.72.0",
"sidebar-v2": "^0.4.0"
},
"scripts": {
"build": "npx webpack"
}
}
Thanks for this test case. It helped a lot while fixing it. It is fixed in v2.3.4 now
Reopening this issue as the fix caused another issue (issue #89) The change is reverted in v2.3.5
@silverwind I have fixed this in v2.3.6. Let me know if you see any issues.
@tstibbs Please try in v2.3.7. There was one bug in v2.3.6 that prevented it from working on webpack 4.
@xz64 tested with 2.3.9 (the latest at this point) and your change seems to have fixed the error for me and everything still seems to be working - thank you very much.
I want all my licences listed in a single file, so I am configuring the plugin like this:
However my webpack build log now has multiple occurrences of the following warning (approx one warning per chunk):
This suggests webpack isn't happy with something that license-webpack-plugin is doing. Having said that, my licenses.txt does appear to contain everything it should (but that maybe that isn't the case for all scenarios).