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
Cant resolve modules #1155
Comments
You need to explicitly specify this option for client and server config separately, because webpack mutates this section =/ // tools/webpack.config.js
// ...
const clientConfig = {
// ...
resolve: {
modules: [path.resolve(__dirname, '../src'), 'node_modules'],
},
// ...
};
const serverConfig = {
// ...
resolve: {
modules: [path.resolve(__dirname, '../src'), 'node_modules'],
},
// ...
};
// ... |
currently we have:
But it not working |
Please help me resolve this issue :) |
If you want to use absolute paths to your modules you also need to mark your modules as internal here for server-side bundle or copy them manually to the build folder so that |
the link is not working or private - have a similar issue with installing react-office-fabric and then not resolving because of the /src/ in between the path resolve. |
@frenzzy Private links should not be here :-) |
@Kohze Are you still interested or this can be closed? If so, reopen please :-) |
oops, was a wrong link) |
@frenzzy can you write sample internals config for src folder? |
sure, for example if you want to make // tools/webpack.config.js
// ...
const clientConfig = {
// ...
resolve: {
modules: [path.resolve(__dirname, '..'), 'node_modules'],
},
// ...
};
const serverConfig = {
// ...
resolve: {
modules: [path.resolve(__dirname, '..'), 'node_modules'],
},
externals: [
/^\.\/assets\.json$/,
(context, request, callback) => {
const isExternal =
request.match(/^[@a-z][a-z/.\-0-9]*$/i) &&
!request.match(/^src\//i) && // module is not external if starts with `src/`
!request.match(/\.(css|less|scss|sss)$/i);
callback(null, Boolean(isExternal));
},
],
// ...
};
// ... |
... and solution for Atom js-hyperclick |
In webpack config we have:
resolve: { modules: [path.resolve(__dirname, '../src'), 'node_modules'], }
But when
import Link from 'components/Link'
Found error:
Error: Cannot find module 'components/Link'
The text was updated successfully, but these errors were encountered: