-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[core] Migrate @mui/x-license-pro
to the new bundling strategy
#3738
[core] Migrate @mui/x-license-pro
to the new bundling strategy
#3738
Conversation
@mui/x-license-pro
to the new bundling strategy
These are the results for the performance tests:
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
plugins: [ | ||
[ | ||
'transform-react-remove-prop-types', | ||
{ | ||
ignoreFilenames: ['DataGridPro.tsx'], | ||
}, | ||
], | ||
[ | ||
'search-and-replace', |
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.
I moved this replace to babel because once we remove rollup for @mui/x-data-grid-pro
we won't be able to use to current plugin.
"directory": "packages/x-license-pro" | ||
}, | ||
"types": "build/index.d.ts", | ||
"license": "SEE LICENSE IN LICENSE.txt", |
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.
We now need a valid license field for bundling
@@ -57,7 +57,8 @@ | |||
"build:codesandbox": "yarn release:build", | |||
"release:changelog": "node scripts/releaseChangelog", | |||
"release:version": "lerna version --exact --no-changelog --no-push --no-git-tag-version", | |||
"release:build": "cd packages/x-license-pro && yarn build && cd ../grid/x-data-grid-pro && yarn build && cd ../x-data-grid && yarn build && cd ../x-data-grid-generator && yarn build", | |||
"release:build": "yarn release:build:next && cd packages/grid/x-data-grid-pro && yarn build && cd ../x-data-grid && yarn build && cd ../x-data-grid-generator && yarn build", | |||
"release:build:next": "lerna run --parallel --scope \"@mui/x-license-pro\" build", |
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.
I'm following mui/material-ui#30201, mui/material-ui#30200 because we will probably have the same issue.
But for now it's not a problem since I build the only package with the core bundling strategy before the others.
NotFound = 'NotFound', | ||
Invalid = 'Invalid', | ||
Expired = 'Expired', | ||
Valid = 'Valid', | ||
} | ||
|
||
export { LicenseStatus }; |
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.
I have a weird compilation error on Codesandbox otherwise when using our ESM bundle as the input.
It gets the following output:
exports.LicenseStatus = void 0;
Object.defineProperty(exports, "__esModule", {
value: true
});
let LicenseStatus;
exports.LicenseStatus = LicenseStatus;
(function (LicenseStatus) {
LicenseStatus["NotFound"] = "NotFound";
LicenseStatus["Invalid"] = "Invalid";
LicenseStatus["Expired"] = "Expired";
LicenseStatus["Valid"] = "Valid";
})(LicenseStatus || (LicenseStatus = {}));
And exports.LicenseStatus
remains undefined (you can test in the console).
The changes in the code allow to init the enum before exporting it, which solves the problem.
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.
@michaldudak I think you've experienced similar issue with Codesandbox recently. What was your solution to that?
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.
Replace
export enum MyEnum { ... }
With
enum MyEnum {...}
export { MyEnum }
That way you have something like
exports.LicenseStatus = void 0;
Object.defineProperty(exports, "__esModule", {
value: true
});
let LicenseStatus;
-exports.LicenseStatus = LicenseStatus;
(function (LicenseStatus) {
LicenseStatus["NotFound"] = "NotFound";
LicenseStatus["Invalid"] = "Invalid";
LicenseStatus["Expired"] = "Expired";
LicenseStatus["Valid"] = "Valid";
})(LicenseStatus || (LicenseStatus = {}));
+exports.LicenseStatus = LicenseStatus;
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.
It looks like an error in the Codesandbox' bundler. I created an issue in their repo: codesandbox/codesandbox-client#6435
@flaviendelangle nice work finding a workaround!
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.
Always a pleasure to dive into compiled code with 5mn between each test due to the build duration 😆
@@ -1,24 +1,5 @@ | |||
const path = require('path'); |
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.
I synced this file with the core one, minus some things (we don't have there error management for instance).
I will do some tests for the packages still on the old bundling. But I would advise against releasing a state where some package use the core bundling strategy and others don't.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
👋 The migration PR has been merged. Please follow these steps to make sure that the contents are all updated. (Sorry for the inconvenience)
If you are struggle with the steps above, feel free to tag @siriwatknp |
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.
I don't have too much to say here but everything seems to still work as expected. We will need to pay more attention when migrating @mui/x-data-grid
.
Codesandbox playground
Part of #18
Part of #3608
What's next ?
@mui/x-data-grid-generator
@mui/x-data-grid-pro
after [DataGridPro] Make@mui/x-data-grid-pro
import shared code from@mui/x-data-grid
#3688@mui/x-data-grid
after the total removal of_modules_