Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move SC onto webpack #1477

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open

Move SC onto webpack #1477

wants to merge 38 commits into from

Conversation

mauritslamers
Copy link
Member

This PR contains the changes required to move SproutCore onto webpack, allowing it to be used much more easily in combination with other tools and frameworks, such as NPM and React.

The use of webpack does bring in a few structural changes:

  • the use of sc_static and static_url is discouraged and will be deprecated. The support within the webpack environment is already more limited (such as that file extensions can no longer be omitted) and a change might require a webpack server restart.
  • the use of sc_super() is discouraged. sc_super() was a macro the build tools replaced with arguments.callee.base.apply(this, arguments). Under ES5 strict and ES6 arguments.callee is no longer available. The alternative for this behavior is using named functions as methods. The more recent versions of the NodeJS buildtools have been attempting to detect this and converting anonymous methods to named methods. The introduction of the method shorthand in ES6 however has made this detecting difficult and error prone. It is therefore suggested to convert any sc_super() calls to their ES5 strict safe counterpart.
  • Webpack treats every script file as a module, very similar to NodeJS / CJS or ES6 modules. This differs from the previous build tools where all files were automatically loaded in the global namespace in the browser. The webpack configuration provided with SproutCore will wrap every file in a function which will run with the window as global this, which will expose most of what happens in a file to the global namespace. There are some subtle differences though, such as that a top level var foo = 'bar'; in a file will no longer automatically be part of the global object (window). Exposing these values now require direct assignment to the window object.

TODO: documentation, project config generation / conversion, project boilerplate, removal of old config files

Maurits Lamers and others added 27 commits April 2, 2022 23:46
but  0.00009999999999999999. Also make the rounding much more reliable with high negative decimalPlaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant