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

Error on Mac and Linux when using classes, while on Windows everything is working fine. #94

Open
ptimer opened this issue Apr 5, 2023 · 0 comments

Comments

@ptimer
Copy link

ptimer commented Apr 5, 2023

config-overrides.js

const { aliasWebpack } = require('react-app-alias-ex')
const path = require('path');

module.exports = function override(config) {
	aliasWebpack({
		alias: {
			'@commonTypes': path.resolve(__dirname, '../../../some-common-types/')
		}
	})(config);

	return config;
}

some-common-types/firstFile.ts

import { ExampleClass } from '@commonTypes/anotherFile'

export class ExportedClass {
  static create() {
    return new ExampleClass();
  }
}

some-common-types/secondFile.ts

export class ExampleClass {
    name: string;
  }

Let's call it inside a React component.

import { ExportedClass } from '@commonTypes/firstFile'

const SomeComponent = (): JSX.Element => {
ExportedClass.create();
...
}

Error

/home/user/Desktop/project/public/dash/node_modules/react-dev-utils/ModuleScopePlugin.js:32
request.descriptionFileRoot.indexOf('/node_modules/') !== -1 ||
^

TypeError: Cannot read properties of undefined (reading 'indexOf')
at /home/user/Desktop/project/public/dash/node_modules/react-dev-utils/ModuleScopePlugin.js:32:39
at Hook.eval [as callAsync] (eval at create (/home/user/Desktop/project/public/dash/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:52:1)
at Resolver.doResolve (/home/user/Desktop/project/public/dash/node_modules/enhanced-resolve/lib/Resolver.js:432:16)
at /home/user/Desktop/project/public/dash/node_modules/enhanced-resolve/lib/TryNextPlugin.js:32:14
at _next0 (eval at create (/home/user/Desktop/project/public/dash/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:173:1)
at eval (eval at create (/home/user/Desktop/project/public/dash/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:195:1)
at /home/user/Desktop/project/public/dash/node_modules/enhanced-resolve/lib/ConditionalPlugin.js:40:47
at Hook.eval [as callAsync] (eval at create (/home/user/Desktop/project/public/dash/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:187:1)
at Resolver.doResolve (/home/user/Desktop/project/public/dash/node_modules/enhanced-resolve/lib/Resolver.js:432:16)
at /home/user/Desktop/project/public/dash/node_modules/enhanced-resolve/lib/ConditionalPlugin.js:42:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant