Unknown plugin "Relay" - React, GraphQL and Relay - node.js

I'm a beginner in GraphQL. I just started to follow the tutorial in Here But I'm getting this compilation problem:
Unknown plugin "Relay"
This is my package.json
{
"name": "hackernews-react-relay",
"version": "0.1.0",
"private": true,
"dependencies": {
"autoprefixer": "7.1.2",
"babel-core": "^6.5.2",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.1",
"babel-preset-react-app": "^3.0.2",
"babel-runtime": "6.26.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"css-loader": "0.28.4",
"dotenv": "4.0.0",
"eslint": "4.4.1",
"eslint-config-react-app": "^2.0.0",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.35.0",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.1.0",
"extract-text-webpack-plugin": "3.0.0",
"file-loader": "0.11.2",
"fs-extra": "3.0.1",
"html-webpack-plugin": "2.29.0",
"jest": "20.0.4",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.6",
"promise": "8.0.1",
"react": "^15.6.1",
"react-dev-utils": "^4.0.1",
"react-dom": "^15.6.1",
"react-relay": "^1.3.0",
"style-loader": "0.18.2",
"sw-precache-webpack-plugin": "0.11.4",
"url-loader": "0.5.9",
"webpack": "3.5.1",
"webpack-dev-server": "2.7.1",
"webpack-manifest-plugin": "1.2.1",
"whatwg-fetch": "2.0.3"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom"
},
"devDependencies": {
"babel-plugin-relay": "^1.3.0",
"relay-compiler": "^1.3.0"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.js?(x)",
"<rootDir>/src/**/?(*.)(spec|test).js?(x)"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
},
"moduleFileExtensions": [
"web.js",
"js",
"json",
"web.jsx",
"jsx",
"node"
]
},
"babel": {
"presets": [
"react-app"
],
"plugins": [
"relay"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
I'm following step by step the tutorial mentioned above.
OS: Ubuntu 17.04
Node 8.0.0
npm 5.0.0
I've already trying to solve this problem by adding this to babel-presets
"es2015",
"stage-0",
"react"
and this to babel plugins
"babel-relay-plugin-loader"
But nothing works.

Instead of providing a relay option in your plugins definition, you can create a file called for example babelRelayPlugin.js and put the plugin definition there since the plugin needs to load the schema before used.
There you can import the getBabelRelayPlugin pass in the schema and export it back.
import getbabelRelayPlugin from 'babel-relay-plugin';
import schema from '../schema/schema.json';
export default getbabelRelayPlugin(schema.data);
Then use this file in your plugins definition instead.
"babel": {
"presets": [
"react-app"
],
"plugins": [
"./babelRelayPlugin"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
note: I am assuming that both the package.json and the babelRelayPlugin.js files live in the same directory

Related

React + NPM Material UI: Npm install error Unable to resolve dependency tree

After installing materialUI I'm having issues when trying to run an npm install on my application that was created with create-react-app.
I've tried deleting node_modules & package_lock.json multiple times - issue persists.
I can continue to install npm packages using --force however, not ideal. I'd like to understand what the issue is here.
Error:
package.json:
{
"name": "video-upload",
"version": "0.1.0",
"private": true,
"dependencies": {
"#babel/core": "7.1.6",
"#material-ui/core": "^4.12.4",
"#mui/material": "^5.11.0",
"#svgr/webpack": "2.4.1",
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.4.0",
"#testing-library/user-event": "^13.5.0",
"#types/jest": "^27.5.2",
"#types/node": "^16.18.4",
"#types/react": "^18.0.26",
"#types/react-dom": "^18.0.9",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "9.0.0",
"babel-jest": "23.6.0",
"babel-loader": "8.0.4",
"babel-plugin-named-asset-import": "^0.3.0",
"babel-preset-react-app": "^7.0.0",
"bfj": "6.1.1",
"case-sensitive-paths-webpack-plugin": "2.1.2",
"chalk": "2.4.1",
"css-loader": "1.0.0",
"dotenv": "6.0.0",
"dotenv-expand": "4.2.0",
"eslint": "5.6.0",
"eslint-config-react-app": "^3.0.6",
"eslint-loader": "2.1.1",
"eslint-plugin-flowtype": "2.50.1",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-jsx-a11y": "6.1.2",
"eslint-plugin-react": "7.11.1",
"file-loader": "2.0.0",
"fork-ts-checker-webpack-plugin-alt": "0.4.14",
"fs-extra": "7.0.0",
"html-webpack-plugin": "4.0.0-alpha.2",
"identity-obj-proxy": "3.0.0",
"jest": "23.6.0",
"jest-pnp-resolver": "1.0.1",
"jest-resolve": "23.6.0",
"mini-css-extract-plugin": "0.4.3",
"optimize-css-assets-webpack-plugin": "5.0.1",
"pnp-webpack-plugin": "1.1.0",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-loader": "3.0.0",
"postcss-preset-env": "6.3.1",
"postcss-safe-parser": "4.0.1",
"react": "^18.2.0",
"react-app-polyfill": "^0.2.0",
"react-dev-utils": "^7.0.1",
"react-dom": "^18.2.0",
"react-router-dom": "^6.4.4",
"react-scripts": "5.0.0",
"resolve": "1.8.1",
"sass-loader": "7.1.0",
"style-loader": "0.23.0",
"styled-components": "^5.3.6",
"terser-webpack-plugin": "1.1.0",
"typescript": "^4.9.3",
"url-loader": "1.1.1",
"web-vitals": "^2.1.4",
"webpack": "4.19.1",
"webpack-dev-server": "3.1.14",
"webpack-manifest-plugin": "2.0.4",
"workbox-webpack-plugin": "3.6.3"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"#types/styled-components": "^5.1.26"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}",
"!src/**/*.d.ts"
],
"resolver": "jest-pnp-resolver",
"setupFiles": [
"react-app-polyfill/jsdom"
],
"setupTestFrameworkScriptFile": "<rootDir>/src/setupTests.ts",
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,ts,tsx}"
],
"testEnvironment": "jsdom",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
"^.+\\.module\\.(css|sass|scss)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web",
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
},
"moduleFileExtensions": [
"web.js",
"js",
"web.ts",
"ts",
"web.tsx",
"tsx",
"json",
"web.jsx",
"jsx",
"node"
]
},
"babel": {
"presets": [
"react-app"
]
}
}
Your package 'fe-react-app-video-upload' has a dependency on react#18.2.0
It could not match that, given you are installing an old version of MUI. As I see it, you are trying to install MUI with the old method.
The updated version of Material-UI for React, is available at the #mui/xxx org.
Now, if you really do want v4 of MUI, for some reason, you have to force install. That's because v4 has a dependency on old React, while the first package I mentioned, has a dependency on React 18.2.0; any lower version won't do, only higher versions given the ^ symbol in front.

You attempted to import .../node_modules/console-browserify/index.js which falls outside of the project src/ directory

I keep getting the below error when trying to build on AWS Amplify. I don't really understand the error as the node_modules packages should be built by Amplify. (Or course it's outside the src directory - it's a Node package
Is there a solution to this?
2022-07-15T12:18:10.405Z [INFO]: Failed to compile.
2022-07-15T12:18:10.411Z [INFO]: Module not found: Error: You attempted to import /codebuild/output/src341411582/src/react-sol/node_modules/console-browserify/index.js which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
You can either move it inside src/, or add a symlink to it from project's node_modules/.
This is my webpack.config.js
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
module.exports = {
plugins: {
add: [
new webpack.ProvidePlugin({
process: "process/browser.js",
}),
new NodePolyfillPlugin({
excludeAliases: ['console-browserify'], //have tried with and without this
}),
],
},
node: {
fs: "empty",
},
};
package.json (I've listed everything)
{
"name": "mb-react",
"version": "0.1.0",
"private": true,
"dependencies": {
"#chakra-ui/react": "^2.2.1",
"#emailjs/browser": "^3.6.2",
"#emotion/react": "^11.9.3",
"#emotion/styled": "^11.9.3",
"#fontsource/akaya-telivigala": "^4.5.6",
"#fontsource/cabin-sketch": "^4.5.7",
"#fontsource/sora": "^4.5.8",
"#metaplex-foundation/js": "^0.11.7",
"#solana-mobile/wallet-adapter-mobile": "^0.0.1-alpha.1",
"#solana/pay": "^0.2.0",
"#solana/spl-token": "^0.2.0",
"#solana/wallet-adapter-base": "^0.9.8",
"#solana/wallet-adapter-react": "^0.15.7",
"#solana/wallet-adapter-react-ui": "^0.9.9",
"#solana/wallet-adapter-wallets": "^0.16.7",
"#solana/web3.js": "^1.47.3",
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.0.0",
"#testing-library/user-event": "^14.0.0",
"#toruslabs/openlogin": "^2.2.0",
"#walletconnect/web3-provider": "^1.7.8",
"#web3auth/web3auth": "^1.1.0",
"antd": "^4.21.0",
"aws-sdk": "^2.1170.0",
"bignumber.js": "^9.0.2",
"bootstrap": "^5.1.3",
"ethereumjs-abi": "^0.6.8",
"framer-motion": "4.1.17",
"fs": "^0.0.1-security",
"fs-webpack-plugin": "^3.1.3",
"gsap": "^3.10.4",
"jquery": "^3.6.0",
"moralis": "^1.9.0",
"node-polyfill-webpack-plugin": "^2.0.0",
"react": "^18.2.0",
"react-blockies": "^1.4.1",
"react-bootstrap": "^2.4.0",
"react-confetti": "^6.1.0",
"react-dom": "^18.2.0",
"react-moralis": "^1.4.0",
"react-router-dom": "^6.3.0",
"react-scripts": "^5.0.0",
"react-spinners": "^0.12.0",
"react-typewriter-effect": "^1.1.0",
"react-use": "^17.4.0",
"serve": "^13.0.2",
"styled-components": "^5.3.5",
"swiper": "^8.2.5",
"typescript": "^4.7.3",
"web-vitals": "^2.1.4",
"web3uikit": "^0.1.166"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version",
"defaults"
]
},
"devDependencies": {
"assert": "^2.0.0",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"https-browserify": "^1.0.0",
"os-browserify": "^0.3.0",
"process": "^0.11.10",
"react-app-rewired": "^2.2.1",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"url": "^0.11.0"
},
"browser": {
"fs": false,
"path": false,
"os": false
}
}
Alias for console-browserify inside node-polyfill-webpack-plugin is console. Try this:
module.exports = {
plugins: {
add: [
new webpack.ProvidePlugin({
process: "process/browser.js",
}),
new NodePolyfillPlugin({
excludeAliases: ['console'],
}),
],
},
node: {
fs: "empty",
},
};

How to get node packages up-to-date?

I've used a truffle react box to get an app working. npm install gives me lots of deprecation warnings, and alos that some packages need others that aren't installed. Is there a good way, or a place online, that can get my package.json file up to date? Since I'm really new to react, I think having missing packages is sure to cause a lot of lost time. Thank you.
package.json
{
"name": "someApp",
"version": "0.1.0",
"license": "MIT",
"private": true,
"repository": {
"type": "git",
"url": "some repo..."
},
"main": "src/index.js",
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom --watch"
},
"dependencies": {
"dotenv": "^2.0.0",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"react-router-dom": "^4.3.1"
},
"devDependencies": {
"autoprefixer": "6.5.1",
"babel-core": "6.17.0",
"babel-eslint": "7.1.1",
"babel-jest": "17.0.2",
"babel-loader": "6.2.7",
"babel-preset-react-app": "^2.0.1",
"case-sensitive-paths-webpack-plugin": "1.1.4",
"chalk": "1.1.3",
"connect-history-api-fallback": "1.3.0",
"cross-spawn": "4.0.2",
"css-loader": "0.26.0",
"debug": "^3.1.0",
"detect-port": "1.0.1",
"eslint": "3.8.1",
"eslint-config-react-app": "^0.5.0",
"eslint-loader": "1.6.0",
"eslint-plugin-flowtype": "2.21.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "2.2.3",
"eslint-plugin-react": "6.4.1",
"extract-text-webpack-plugin": "1.0.1",
"file-loader": "0.9.0",
"filesize": "3.3.0",
"fs-extra": "0.30.0",
"growl": "^1.10.2",
"gzip-size": "3.0.0",
"html-webpack-plugin": "2.24.0",
"http-proxy-middleware": "0.17.2",
"jest": "19.0.1",
"json-loader": "0.5.4",
"minimatch": "^3.0.2",
"object-assign": "4.1.0",
"openzeppelin-solidity": "1.11.0",
"path-exists": "2.1.0",
"postcss-loader": "1.0.0",
"promise": "7.1.1",
"react-dev-utils": "^0.4.2",
"recursive-readdir": "2.1.0",
"stmux": "^1.5.5",
"strip-ansi": "3.0.1",
"style-loader": "0.13.1",
"truffle": "^4.1.13",
"truffle-contract": "^1.1.8",
"truffle-hdwallet-provider": "0.0.6",
"truffle-solidity-loader": "0.0.8",
"url-loader": "^1.0.1",
"webpack": "^1.14.0",
"webpack-dev-server": "^1.16.2",
"webpack-manifest-plugin": "^1.1.0",
"whatwg-fetch": "^1.0.0"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.js?(x)",
"<rootDir>/coverage/**/?(*.)(spec|test).js?(x)"
],
"testEnvironment": "node",
"testURL": "http://127.0.0.1:7200",
"transform": {
"^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
},
"moduleFileExtensions": [
"web.js",
"js",
"json",
"web.jsx",
"jsx"
]
},
"babel": {
"presets": [
"react-app"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
A really cool package i've used is npm-check
It provides a nice interface to tell you what packages are outdated.
interface image
to install the package, run in your terminal: npm install -g npm-check
To check packages, run: npm-check in the directory that contains the package.json you are checking.

req.handle.writev is not a function

I'm using React, React-Redux with Webpack for my project in a Docker container and keep running into this error
internal/stream_base_commons.js:59 var err = req.handle.writev(req,
chunks, allBuffers);
^
TypeError: req.handle.writev is not a function
at writevGeneric (internal/stream_base_commons.js:59:24)
at Socket._writeGeneric (net.js:758:5)
at Socket._writev (net.js:767:8)
at doWrite (_stream_writable.js:408:12)
at clearBuffer (_stream_writable.js:517:5)
at Socket.Writable.uncork (_stream_writable.js:314:7)
at connectionCorkNT (_http_outgoing.js:646:8)
at process._tickCallback (internal/process/next_tick.js:63:19)
The following is my versions
NODE_VERSION 8.9
YARN_VERSION 1.7.0
OS Docker Linux/ Raspbian Lite
Webpack/ Webpack-Ddv-Server (latest)
React/ Redux (latest)
My package.json
{
....
"dependencies": {
"object-assign": "*",
"raf": "*",
"react": "*",
"react-dev-utils": "*",
"react-dom": "*",
"react-facebook-login": "*",
"react-helmet": "*",
"react-loadable": "*",
"react-slick": "*",
"react-router": "*",
"react-router-dom": "*",
"react-redux":"*",
"redux":"*",
"redux-thunk":"*",
"slick-carousel":"*",
"font-awesome":"*"
},
"devDependencies": {
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.8",
"promise": "8.0.1",
"autoprefixer": "7.1.6",
"babel-core": "6.26.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.2",
"babel-preset-react-app": "^3.1.1",
"babel-runtime": "6.26.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"node-sass-chokidar": "*",
"npm-run-all": "*",
"sass-loader": "*",
"sw-precache-webpack-plugin": "0.11.4",
"resolve": "1.6.0",
"style-loader": "0.19.0",
"url-loader": "0.6.2",
"webpack": "*",
"webpack-dev-server": "*",
"webpack-manifest-plugin": "*",
"whatwg-fetch": "2.0.3",
"chalk": "1.1.3",
"css-loader": "0.28.7",
"dotenv": "4.0.0",
"dotenv-expand": "4.2.0",
"eslint": "4.10.0",
"eslint-config-react-app": "^2.1.0",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.39.1",
"eslint-plugin-import": "2.8.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.4.0",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "*",
"fs-extra": "*",
"html-webpack-plugin": "*",
"jest": "20.0.4"
},
"scripts": {
"start-js": "node scripts/start.js",
"start": "npm-run-all -p watch-css start-js",
"build-js": "node scripts/build.js",
"build": "npm-run-all build-css build-js",
"build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/",
"watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/ -o src/ --watch --recursive",
"test": "node scripts/test.js --env=jsdom",
"postinstall": "npm run start"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,mjs}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}",
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
},
"moduleFileExtensions": [
"web.js",
"js",
"json",
"web.jsx",
"jsx",
"node",
"mjs"
]
},
"babel": {
"presets": [
"react-app"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
Anyone else with this issue? Does not happen often but does frustrate the development process
I was getting this error on Windows 10 x64 on NodeJS version 10.13.0. I simply removed NodeJS version 10.13.0 and installed version 8.11.3 and restarted my machine and it was gone!
Anyone else with this issue? Yes...This problem is happening a lot with me and it is making me nervous, but usually, when it is happening I restart my computer and its gone!
For now, I think restarting the computer is the solution because I have searched too much for a solution, but I got zero results.
Delete node and do yarn install

unable to import THREE.js in es6

I'm trying to show a three.js scene inside a div using create react app. However, it throws an undefined THREE.
Tried
npm install --save three
import * as THREE from 'three'
But doesn't seem to work, it always throws THREE is not defined no-undef. Kindly have a look at my repo as well. https://github.com/priyakrishnadev/webglapp
Update:
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"autoprefixer": "7.1.6",
"axios": "^0.16.2",
"babel-core": "6.26.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.2",
"babel-polyfill": "^6.26.0",
"babel-preset-react-app": "^3.1.0",
"babel-runtime": "6.26.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"classnames": "^2.2.5",
"css-loader": "0.28.7",
"dotenv": "4.0.0",
"eslint": "4.10.0",
"eslint-config-react-app": "^2.0.1",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.39.1",
"eslint-plugin-import": "2.8.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.4.0",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.5",
"fs-extra": "3.0.1",
"html-webpack-plugin": "2.29.0",
"jest": "20.0.4",
"lodash": "^4.17.4",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "3.2.0",
"postcss-loader": "2.0.8",
"promise": "8.0.1",
"prop-types": "^15.6.0",
"raf": "3.4.0",
"react": "^16.1.0",
"react-dev-utils": "^4.2.1",
"react-dom": "^16.1.0",
"react-redux": "^5.0.6",
"react-router-dom": "^4.2.2",
"react-timeago": "3.4.3",
"redux": "^3.7.2",
"redux-devtools-extension": "^2.13.2",
"redux-form": "^7.0.4",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0",
"style-loader": "0.19.0",
"sw-precache-webpack-plugin": "0.11.4",
"three": "^0.88.0",
"timeago-react": "^2.0.0",
"url-loader": "0.6.2",
"uuid": "^3.1.0",
"webpack": "3.8.1",
"webpack-dev-server": "2.9.4",
"webpack-manifest-plugin": "1.3.2",
"whatwg-fetch": "2.0.3"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js --env=jsdom"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,mjs}"
],
"setupFiles": [
"<rootDir>/config/polyfills.js"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}",
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}"
],
"testEnvironment": "node",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web"
},
"moduleFileExtensions": [
"web.js",
"mjs",
"js",
"json",
"web.jsx",
"jsx",
"node"
]
},
"babel": {
"presets": [
"react-app"
]
},
"eslintConfig": {
"extends": "react-app"
}
}
The problem is is that you are importing THREE as es6 modules, but then trying to include DDSLoader, MTLLoader and OBJLoader which are not in THREE and are not set up as modules (as they are in the /exmaples/js/ folder in three.js).
You need to use versions that are set up as modules. eg three-obj-loader.
There are a few of these, and some are set up differently from others, some even set up specifically for use with react, so you are going to have to look at how to implement the one you choose. Search for them on the npm site.
An example of using three-obj-loader can be seen as an answer on this stack question.

Resources