Skip to content

Commit

Permalink
[utils] Use consistent build approach (#40837)
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp committed Feb 1, 2024
1 parent 56302c9 commit 5e811b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/mui-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"build": "pnpm build:legacy && pnpm build:modern && pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files",
"build:legacy": "node ../../scripts/build.mjs legacy",
"build:modern": "node ../../scripts/build.mjs modern",
"build:node": "node ../../scripts/build.mjs node --ignoreTopLevel",
"build:stable": "node ../../scripts/build.mjs stable --ignoreTopLevel",
"build:node": "node ../../scripts/build.mjs node",
"build:stable": "node ../../scripts/build.mjs stable",
"build:copy-files": "node ../../scripts/copyFiles.mjs",
"build:types": "node ../../scripts/buildTypes.mjs",
"prebuild": "rimraf build tsconfig.build.tsbuildinfo",
Expand Down
11 changes: 3 additions & 8 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const validBundles = [
];

async function run(argv) {
const { bundle, largeFiles, outDir: relativeOutDir, verbose, ignoreTopLevel } = argv;
const { bundle, largeFiles, outDir: relativeOutDir, verbose } = argv;

if (validBundles.indexOf(bundle) === -1) {
throw new TypeError(
Expand Down Expand Up @@ -62,9 +62,9 @@ async function run(argv) {
//
// TODO v6: Switch to `exports` field.
{
node: !ignoreTopLevel && topLevelPathImportsCanBePackages ? './node' : './',
node: topLevelPathImportsCanBePackages ? './node' : './',
modern: './modern',
stable: !ignoreTopLevel && topLevelPathImportsCanBePackages ? './' : './esm',
stable: topLevelPathImportsCanBePackages ? './' : './esm',
legacy: './legacy',
}[bundle],
);
Expand Down Expand Up @@ -119,11 +119,6 @@ yargs(process.argv.slice(2))
describe: 'Set to `true` if you know you are transpiling large files.',
})
.option('out-dir', { default: './build', type: 'string' })
.option('ignoreTopLevel', {
type: 'boolean',
default: false,
describe: 'Set to `true` to ignore switching out-dir based on top level import.',
})
.option('verbose', { type: 'boolean' });
},
handler: run,
Expand Down
2 changes: 1 addition & 1 deletion scripts/sizeSnapshot/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ async function getWebpackEntries() {
...coreComponents,
{
id: '@material-ui/utils',
path: 'packages/mui-utils/build/esm/index.js',
path: 'packages/mui-utils/build/index.js',
},
// TODO: Requires webpack v5
// Resolution of webpack/acorn to 7.x is blocked by nextjs (https://github.com/vercel/next.js/issues/11947)
Expand Down

0 comments on commit 5e811b8

Please sign in to comment.