Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ module.exports = function getBabelConfig(api) {
{
useESModules,
// any package needs to declare 7.25.0 as a runtime dependency. default is ^7.0.0
version: '^7.25.0',
version: process.env.MUI_BABEL_RUNTIME_VERSION || '^7.25.0',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% satisfied with this solution but the babel config is used both by our build and by babel-node. MUI_BABEL_RUNTIME_VERSION may not always be defined. This seemed to be the lesser of evils, the existence is already checked in the build script

},
],
[
Expand Down
1 change: 1 addition & 0 deletions packages/mui-material-pigment-css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"typescript:module-augmentation": "node scripts/testModuleAugmentation.js"
},
"dependencies": {
"@babel/runtime": "^7.25.0",
"@mui/system": "workspace:*",
"@pigment-css/react": "0.0.20"
},
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import glob from 'fast-glob';
import path from 'path';
import { promisify } from 'util';
import yargs from 'yargs';
import * as fs from 'fs/promises';
import { getVersionEnvVariables, getWorkspaceRoot } from './utils.mjs';

const exec = promisify(childProcess.exec);
Expand All @@ -25,10 +26,21 @@ async function run(argv) {
);
}

const packageJsonPath = path.resolve('./package.json');
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, { encoding: 'utf8' }));

const babelRuntimeVersion = packageJson.dependencies['@babel/runtime'];
if (!babelRuntimeVersion) {
throw new Error(
'package.json needs to have a dependency on `@babel/runtime` when building with `@babel/plugin-transform-runtime`.',
);
}

const env = {
NODE_ENV: 'production',
BABEL_ENV: bundle,
MUI_BUILD_VERBOSE: verbose,
MUI_BABEL_RUNTIME_VERSION: babelRuntimeVersion,
...(await getVersionEnvVariables()),
};

Expand Down