You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The framework/Gulpfile.js exposes a lot of ES6 modules (both vendor and custom code). This is used to avoid duplicating code in bundle files in other modules. For example, the JS code for the react ES6 module is only included once in framework, and then referenced in asset-admin/Gulpfile.js.
This approach leads to fragile bundles: If a developer forgets to expose an ES6 module in framework , it'll be inaccessible to other SilverStripe modules. If other SilverStripe modules pull in NPM dependencies for those ES6 modules as well, this can lead to the same JavaScript code being bundled twice. This works, due to the closure isolation in individual bundle files. But it makes it very hard to debug and set breakpoints.
Create a browserify plugin which automatically exposes all modules it loads through require/import
Publish SilverStripe's custom ES6 code in framework as an NPM repo, add it to other SilverStripe modules as a dependency - and live with the bundle code duplication and potential version mismatches. This would still require expose on react and other "heavy" dependencies, we can't duplicate those in each bundle. Would also fix the current NPM include path issues (IDEs don't pick up import components/Form/Form in asset-admin since it's not defined in node_modules).
The text was updated successfully, but these errors were encountered:
Hmmm, I believe it's the same issue, just in a different build tool: We still have lots of expose and externals calls - presumably they'll exhibit the same behaviour if you forget to add one (bundling duplicates)
The
framework/Gulpfile.js
exposes a lot of ES6 modules (both vendor and custom code). This is used to avoid duplicating code in bundle files in other modules. For example, the JS code for thereact
ES6 module is only included once inframework
, and then referenced inasset-admin/Gulpfile.js
.This approach leads to fragile bundles: If a developer forgets to expose an ES6 module in
framework
, it'll be inaccessible to other SilverStripe modules. If other SilverStripe modules pull in NPM dependencies for those ES6 modules as well, this can lead to the same JavaScript code being bundled twice. This works, due to the closure isolation in individual bundle files. But it makes it very hard to debug and set breakpoints.framework/Gulpfile.js
asset-admin/Gulpfile.js
Options:
require
/import
framework
as an NPM repo, add it to other SilverStripe modules as a dependency - and live with the bundle code duplication and potential version mismatches. This would still requireexpose
onreact
and other "heavy" dependencies, we can't duplicate those in each bundle. Would also fix the current NPM include path issues (IDEs don't pick upimport components/Form/Form
inasset-admin
since it's not defined innode_modules
).The text was updated successfully, but these errors were encountered: