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

[core] Error when installing in unsupported node environments #25798

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"buildCommand": "build:codesandbox",
"installCommand": "install:codesandbox",
"node": "12",
"packages": [
"packages/material-ui",
"packages/material-ui-icons",
Expand Down
1 change: 0 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ function resolveAliasPath(relativeToBabelConf) {
}

const defaultAlias = {
'@material-ui/core': resolveAliasPath('./packages/material-ui/src'),
'@material-ui/docs': resolveAliasPath('./packages/material-ui-docs/src'),
'@material-ui/icons': resolveAliasPath('./packages/material-ui-icons/src'),
'@material-ui/lab': resolveAliasPath('./packages/material-ui-lab/src'),
Expand Down
1 change: 1 addition & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function resolvePath(sourcePath, currentFile, opts) {
return bpmr.resolvePath(sourcePath, currentFile, opts);
}

// TODO: Can be dropped with webpack 5 which supports the `exports` field
const alias = {
'@material-ui/core': '../packages/material-ui/src',
'@material-ui/docs': '../packages/material-ui-docs/src',
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui-codemod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
"access": "public"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
}
}
1 change: 1 addition & 0 deletions packages/material-ui-codemod/src/v4.0.0/optimal-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { dirname } from 'path';
import addImports from 'jscodeshift-add-imports';
import getJSExports from '../util/getJSExports';

// TODO: do we still need this?
// istanbul ignore next
if (process.env.NODE_ENV === 'test') {
const resolve = require.resolve;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default function transformer(fileInfo, api, options) {

let requirePath = importModule;

// TODO: do we still need this?
if (process.env.NODE_ENV === 'test') {
requirePath = requirePath.replace(/^@material-ui\/core/, '../../../material-ui/src');
}
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
"access": "public"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/material-ui-icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@
"access": "public"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/material-ui-lab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@
"access": "public"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/material-ui-styled-engine-sc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@
"access": "public"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/material-ui-styled-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@
"access": "public"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/material-ui-styles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@
"access": "public"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/material-ui-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
"access": "public"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/material-ui-unstyled/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@
"access": "public"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/material-ui-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@
"access": "public"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
}
}
7 changes: 5 additions & 2 deletions packages/material-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"private": false,
"author": "Material-UI Team",
"description": "Quickly build beautiful React apps. Material-UI is a simple and customizable component library to build faster, beautiful, and more accessible React applications. Follow your own design system, or start with Material Design.",
"main": "./src/index.ts",
"exports": {
".": "./index.ts",
"./*": "./src/*/index.js"
},
"keywords": [
"react",
"react-component",
Expand Down Expand Up @@ -80,6 +83,6 @@
"access": "public"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/netlify-plugin-cache-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"fs-extra": "^9.0.1"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
}
}
13 changes: 10 additions & 3 deletions scripts/copy-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,16 @@ async function typescriptCopy({ from, to }) {

async function createPackageFile() {
const packageData = await fse.readFile(path.resolve(packagePath, './package.json'), 'utf8');
const { nyc, scripts, devDependencies, workspaces, ...packageDataOther } = JSON.parse(
packageData,
);
const {
nyc,
scripts,
devDependencies,
workspaces,
// Using native ES 6 modules internally only for now
exports,
type,
...packageDataOther
} = JSON.parse(packageData);

const newPackageData = {
...packageDataOther,
Expand Down
2 changes: 2 additions & 0 deletions webpackBaseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ module.exports = {
context: path.resolve(__dirname),
resolve: {
modules: [__dirname, 'node_modules'],
// TODO: Can be dropped with webpack 5 which supports the `exports` field
// But might be required for eslint-plugin-import: https://github.com/benmosher/eslint-plugin-import/issues/1868
alias: {
'@material-ui/core': path.resolve(__dirname, './packages/material-ui/src'),
'@material-ui/docs': path.resolve(__dirname, './packages/material-ui-docs/src'),
Expand Down