-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(build): Handle minification in rollup config generation function #4681
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
ref(build): Handle minification in rollup config generation function #4681
Conversation
size-limit report
|
6f5727e
to
261d1e8
Compare
rollup.config.js
Outdated
} | ||
export function insertAt(arr, index, insertee) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't prettier?
} | |
export function insertAt(arr, index, insertee) { | |
} | |
export function insertAt(arr, index, insertee) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean, does prettier get mad that there's not a blank line there? No - it would have failed linting. My thinking in not putting a blank there is I wanted the comment to apply to both, and it felt like they were both small enough I could get away with it. But you're not wrong, it's a little weird looking. Compromise option:
/**
* Helper functions to compensate for the fact that JS can't handle negative array indices very well
*
* TODO `insertAt` is only exported so the integrations config can inject the `commonjs` plugin, for localforage (used
* in the offline plugin). Once that's fixed to no longer be necessary, this can stop being exported.
*/
const getLastElement = array => {
return array[array.length - 1];
};
export const insertAt = (arr, index, insertee) => {
const newArr = [...arr];
// Add 1 to the array length so that the inserted element ends up in the right spot with respect to the length of the
// new array (which will be one element longer), rather than that of the current array
const destinationIndex = index >= 0 ? index : arr.length + 1 + index;
newArr.splice(destinationIndex, 0, insertee);
return newArr;
};
Functionally* the same, but having two consts in a row is better. I'll switch it to that.
* no pun intended, I swear
261d1e8
to
f8b436e
Compare
f8b436e
to
6b30492
Compare
As part of the new build process, this removes minification config from being hardcoded in individual
rollup.config.js
files and instead uses a new function in the mainrollup.config.js
to generate minified and unminified variants of each build config it's given.This PR also includes a few other small changes:
rollup.config.js
files to have more parallel structure.markAsBrowserBulid
plugin so it has the work "plugin" in its name.Ref: https://getsentry.atlassian.net/browse/WEB-633