waysact / webpack-subresource-integrity

Webpack plugin for enabling Subresource Integrity.
MIT License
357 stars 46 forks source link

Incorrect warning with Webpack 5 and array target option #138

Closed clydin closed 3 years ago

clydin commented 3 years ago

Current Behavior:

When using Webpack 5, the Webpack target option can also be an array of strings (documentation). When this form of the option is used, this plugin will issue a warning even if web is present in the target option array.

Expected Behavior:

When the target option is an array and the array contains a web element, this plugin should not emit a warning.

Additional Notes:

For advanced use cases, the target option can also be false (documentation). In this case it allows the user to manually configure target plugins which may include web capabilities. With a value of false, the warning from this plugin may also be considered incorrect in such situations.

jscheid commented 3 years ago

I can't seem to reproduce this, for example with target: ['web', 'es5']. Are you using the latest version? If so, could you let me know a specific target setting that you see the issue with or, even better, provide a demo repository that triggers it?

As for false, for checking compatibility we're now using the chunkLoading setting when available so hopefully that should work as well.

clydin commented 3 years ago

Updating to 1.5.2 from 1.5.1 does indeed prevent the error due to the new chunkLoading check. Technically a configuration with chunkLoading: false & target: ['web', 'es5'] would trigger the warning but that is probably not common enough to special case.

Thank you for the quick response.