numical / script-ext-html-webpack-plugin

Enhances html-webpack-plugin functionality with different deployment options for your scripts including 'async', 'preload', 'prefetch', 'defer', 'module', custom attributes, and inlining.
MIT License
588 stars 105 forks source link

handle the runtime failure with latest cra #87

Closed aga5tya closed 4 years ago

aga5tya commented 4 years ago

When tried using the script on CRA setup with multi setup, this plugin fails with below error. This fix adds a defensive check when the attributes key is empty.

$ NODE_ENV=production react-app-rewired build
Creating an optimized production build...
Failed to compile.

Cannot set property 'defer' of undefined

Deps: "react-app-rewire-multiple-entry": "^2.2.0", "react-app-rewired": "^2.1.6", "react-scripts": "4.0.0",

numical commented 4 years ago

HI @aga5tya - I'm sorry but have you seen the deprection announcement on README?

aga5tya commented 4 years ago

Hi @numical, I understand. Since it was a very minor fix and possibly someone else could be facing it on the last released version, I thought I'l just put forth via PR as a reference for others.