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

fix(react-core): fix importing of mui packages that do not support ESM yet #3608

Merged
merged 12 commits into from
Dec 21, 2022
3 changes: 2 additions & 1 deletion packages/dx-react-chart-bootstrap4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"require": "./dist/dx-react-chart-bootstrap4.umd.cjs",
"import": "./dist/dx-react-chart-bootstrap4.es.js",
"default": "./dist/dx-react-chart-bootstrap4.es.js"
}
},
"./dist/dx-react-chart-bootstrap4.css": "./dist/dx-react-chart-bootstrap4.css"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 0 additions & 4 deletions packages/dx-react-chart-material-ui/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
"plugins": [
["transform-react-remove-prop-types", {
"mode": "unsafe-wrap"
}],
["transform-rename-import", {
"original": "^@mui\\/material\\/(.*)$",
"replacement": "@mui/material/node/$1/index.js"
}]
],
"env": {
Expand Down
3 changes: 2 additions & 1 deletion packages/dx-react-grid-bootstrap4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"require": "./dist/dx-react-grid-bootstrap4.umd.cjs",
"import": "./dist/dx-react-grid-bootstrap4.es.js",
"default": "./dist/dx-react-grid-bootstrap4.es.js"
}
},
"./dist/dx-react-grid-bootstrap4.css": "./dist/dx-react-grid-bootstrap4.css"
},
"main": "dist/dx-react-grid-bootstrap4.umd.cjs",
"module": "dist/dx-react-grid-bootstrap4.es.js",
Expand Down
4 changes: 0 additions & 4 deletions packages/dx-react-grid-material-ui/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
"plugins": [
["transform-react-remove-prop-types", {
"mode": "unsafe-wrap"
}],
["transform-rename-import", {
"original": "^@mui\\/material\\/(.*)$",
"replacement": "@mui/material/node/$1/index.js"
}]
],
"env": {
Expand Down
4 changes: 2 additions & 2 deletions packages/dx-react-grid-material-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"babel-eslint": "^10.0.3",
"babel-jest": "^29.2.2",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"babel-plugin-transform-rename-import": "^2.3.0",
"core-js": "^3.4.1",
"enzyme": "3.10.0",
"eslint": "^6.6.0",
Expand All @@ -92,7 +91,8 @@
"react-test-renderer": "^17.0.2",
"rollup": "^1.27.2",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-license": "^0.12.1"
"rollup-plugin-license": "^0.12.1",
"rollup-plugin-modify": "^3.0.0"
},
"dependencies": {
"clsx": "^1.0.4",
Expand Down
57 changes: 38 additions & 19 deletions packages/dx-react-grid-material-ui/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,47 @@
import babel from 'rollup-plugin-babel';
import license from 'rollup-plugin-license';
import resolve from '@rollup/plugin-node-resolve';
import modify from 'rollup-plugin-modify';
import { banner, external, stubProcess } from '../../tools/rollup-utils';
import pkg from './package.json';

export default {
const commonPlugins = [
resolve({
extensions: ['.js', '.jsx'],
}),
babel({
runtimeHelpers: true,
exclude: 'node_modules/**',
}),
license({
banner,
}),
];

const commonConfig = {
input: 'src/index.js',
output: [
{
file: pkg.main, format: 'cjs', sourcemap: true, intro: stubProcess,
},
{ file: pkg.module, format: 'es', sourcemap: true },
],
external: external(__dirname),
plugins: [
resolve({
extensions: ['.js', '.jsx'],
}),
babel({
runtimeHelpers: true,
exclude: 'node_modules/**',
}),
license({
banner,
}),
],
plugins: commonPlugins,
};

export default [
{
...commonConfig,
output: {
file: pkg.main, format: 'cjs', sourcemap: true, intro: stubProcess,
},
},
{
...commonConfig,
output: {
file: pkg.module, format: 'es', sourcemap: true,
},
plugins: [
...commonPlugins,
modify({
find: /import (\w+) from '@mui\/icons-material\/(.+)';/,
replace: (match, name, path) => `import ${name}Pkg from '@mui/icons-material/${path}.js'; const ${name} = ${name}Pkg.default;`,
}),
],
},
];
8 changes: 6 additions & 2 deletions packages/dx-react-scheduler-material-ui/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
"mode": "unsafe-wrap"
}],
["transform-rename-import", {
"original": "^@mui\\/material\\/(.*)$",
"replacement": "@mui/material/node/$1/index.js"
"replacements": [
{
"original": "^@mui\\/x-date-pickers\\/(.*)$",
"replacement": "@mui/x-date-pickers/node/$1/index.js"
}
]
}]
],
"env": {
Expand Down
3 changes: 2 additions & 1 deletion packages/dx-react-scheduler-material-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
"react-test-renderer": "^17.0.2",
"rollup": "^1.27.2",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-license": "^0.12.1"
"rollup-plugin-license": "^0.12.1",
"rollup-plugin-modify": "^3.0.0"
},
"dependencies": {
"@date-io/moment": "^1.3.11",
Expand Down
57 changes: 38 additions & 19 deletions packages/dx-react-scheduler-material-ui/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,47 @@
import babel from 'rollup-plugin-babel';
import license from 'rollup-plugin-license';
import resolve from '@rollup/plugin-node-resolve';
import modify from 'rollup-plugin-modify';
import { banner, external, stubProcess } from '../../tools/rollup-utils';
import pkg from './package.json';

export default {
const commonPlugins = [
resolve({
extensions: ['.js', '.jsx'],
}),
babel({
runtimeHelpers: true,
exclude: 'node_modules/**',
}),
license({
banner,
}),
];

const commonConfig = {
input: 'src/index.js',
output: [
{
file: pkg.main, format: 'cjs', sourcemap: true, intro: stubProcess,
},
{ file: pkg.module, format: 'es', sourcemap: true },
],
external: external(__dirname),
plugins: [
resolve({
extensions: ['.js', '.jsx'],
}),
babel({
runtimeHelpers: true,
exclude: 'node_modules/**',
}),
license({
banner,
}),
],
plugins: commonPlugins,
};

export default [
{
...commonConfig,
output: {
file: pkg.main, format: 'cjs', sourcemap: true, intro: stubProcess,
},
},
{
...commonConfig,
output: {
file: pkg.module, format: 'es', sourcemap: true,
},
plugins: [
...commonPlugins,
modify({
find: /import (\w+) from '@mui\/icons-material\/(.+)';/,
replace: (match, name, path) => `import ${name}Pkg from '@mui/icons-material/${path}.js'; const ${name} = ${name}Pkg.default;`,
}),
],
},
];
2 changes: 1 addition & 1 deletion packages/dx-scheduler-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@
},
"dependencies": {
"moment": "^2.24.0",
"rrule": "2.6.4"
"rrule": "2.7.1"
}
}
41 changes: 28 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15829,11 +15829,6 @@ lru-queue@^0.1.0:
dependencies:
es5-ext "~0.10.2"

luxon@^1.21.3:
version "1.27.0"
resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.27.0.tgz#ae10c69113d85dab8f15f5e8390d0cbeddf4f00f"
integrity sha512-VKsFsPggTA0DvnxtJdiExAucKdAnwbCCNlMM5ENvHlxubqWd0xhZcdb4XgZ7QFNhaRhilXCFxHuoObP5BNA4PA==

lz-string@^1.4.4:
version "1.4.4"
resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26"
Expand All @@ -15844,6 +15839,13 @@ macos-release@^2.2.0:
resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.5.0.tgz#067c2c88b5f3fb3c56a375b2ec93826220fa1ff2"
integrity sha512-EIgv+QZ9r+814gjJj0Bt5vSLJLzswGmSUbUpbi9AIr/fsN2IWFBl2NucV9PAiek+U1STK468tEkxmVYUtuAN3g==

magic-string@0.25.2:
version "0.25.2"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.2.tgz#139c3a729515ec55e96e69e82a11fe890a293ad9"
integrity sha512-iLs9mPjh9IuTtRsqqhNGYcZXGei0Nh/A4xirrsqW7c+QhKVFL2vm7U09ru6cHRD22azaP/wMDgI+HCqbETMTtg==
dependencies:
sourcemap-codec "^1.4.4"

magic-string@0.25.3:
version "0.25.3"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.3.tgz#34b8d2a2c7fec9d9bdf9929a3fd81d271ef35be9"
Expand Down Expand Up @@ -17687,6 +17689,13 @@ osenv@^0.1.4, osenv@^0.1.5:
os-homedir "^1.0.0"
os-tmpdir "^1.0.0"

ospec@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/ospec/-/ospec-3.1.0.tgz#d36b8e10110f58f63a463df2390a7a73fe9579a8"
integrity sha512-+nGtjV3vlADp+UGfL51miAh/hB4awPBkQrArhcgG4trAaoA2gKt5bf9w0m9ch9zOr555cHWaCHZEDiBOkNZSxw==
dependencies:
glob "^7.1.3"

ow@^0.17.0:
version "0.17.0"
resolved "https://registry.yarnpkg.com/ow/-/ow-0.17.0.tgz#4f938999fed6264c9048cd6254356e0f1e7f688c"
Expand Down Expand Up @@ -20692,6 +20701,14 @@ rollup-plugin-license@^0.12.1:
mkdirp "0.5.1"
moment "2.24.0"

rollup-plugin-modify@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-modify/-/rollup-plugin-modify-3.0.0.tgz#5326e11dfec247e8bbdd9507f3da1da1e5c7818b"
integrity sha512-p/ffs0Y2jz2dEnWjq1oVC7SY37tuS+aP7whoNaQz1EAAOPg+k3vKJo8cMMWx6xpdd0NzhX4y2YF9o/NPu5YR0Q==
dependencies:
magic-string "0.25.2"
ospec "3.1.0"

rollup-plugin-sass@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-sass/-/rollup-plugin-sass-1.2.2.tgz#f03cd2b1bee497dc2cc845fae2c5749611fc008f"
Expand Down Expand Up @@ -20731,14 +20748,12 @@ rollup@^1.27.2:
"@types/node" "*"
acorn "^7.1.0"

rrule@2.6.4:
version "2.6.4"
resolved "https://registry.yarnpkg.com/rrule/-/rrule-2.6.4.tgz#7f4f31fda12bc7249bb176c891109a9bc448e035"
integrity sha512-sLdnh4lmjUqq8liFiOUXD5kWp/FcnbDLPwq5YAc/RrN6120XOPb86Ae5zxF7ttBVq8O3LxjjORMEit1baluahA==
rrule@2.7.1:
version "2.7.1"
resolved "https://registry.yarnpkg.com/rrule/-/rrule-2.7.1.tgz#2511e1aed0e96fb5acf831304cde97d2cb65d99e"
integrity sha512-4p20u/1U7WqR3Nb1hOUrm0u1nSI7sO93ZUVZEZ5HeF6Gr5OlJuyhwEGRvUHq8ZfrPsq5gfa5b9dqnUs/kPqpIw==
dependencies:
tslib "^1.10.0"
optionalDependencies:
luxon "^1.21.3"
tslib "^2.4.0"

rst-selector-parser@^2.2.3:
version "2.2.3"
Expand Down Expand Up @@ -23239,7 +23254,7 @@ tslib@^2, tslib@^2.0.3, tslib@^2.2.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.0.tgz#803b8cdab3e12ba581a4ca41c8839bbb0dacb09e"
integrity sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==

tslib@^2.4.1:
tslib@^2.4.0, tslib@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e"
integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==
Expand Down