I upgraded Haul from 1.0.0-beta.14 to 1.0.0-RC.5 and get an error since then. If I revert back to beta version and the error is gone.
Wether it's with iOS or Android, debug or release, I get this error:
Cannot find module '{projectRoot}/packages/mobile/node_modules/react-native/Libraries/Core/InitializeCore.js'
Haul should create a JS bundle
Haul should search for modules inside {projectRoot}/node_modules and not inside the package's node_modules folder which doesn't contain anything.
import { createWebpackConfig } from 'haul';
export default {
webpack: env => {
const config = createWebpackConfig({
entry: `./src/index.tsx`,
include: '../../node_modules'
})(env);
config.module.rules = [
{
test: /\.tsx?$/,
loader: 'ts-loader'
},
...config.module.rules
];
config.resolve.extensions = [
'.ts',
'.tsx',
`.${env.platform}.ts`,
'.native.ts',
`.${env.platform}.tsx`,
'.native.tsx',
...config.resolve.extensions
];
return config;
}
};
| software | version
| ---------------- | -------
| Haul | 1.0.0-RC.5
| react-native | ~0.55.2
| node | v9.11.2
| npm or yarn | yarn 1.7.0
I'm using mono repo using workspaces in yarn with lerna. All my modules are installed in {projectRoot}/node_modules.
I am not sure if this is correct, but I had basically the same issue and I fixed it like this:
webpack: env => {
// account for hoisted 'Core' location
env.initializeCoreLocation = '../../node_modules/react-native/Libraries/Core/InitializeCore.js';
const config = createWebpackConfig({
entry: `./index.${env.platform}.js`,
})(env);
I did not find this in docs (perhaps it is documented somewhere?), I went digging into the code and found it in here:
https://github.com/callstack/haul/blob/next/src/utils/makeReactNativeConfig.js
Like I said, I'm not sure if this should be necessary, but it was a way that I got it to work.
This seems like what I was searching for, thanks!
Most helpful comment
I am not sure if this is correct, but I had basically the same issue and I fixed it like this:
I did not find this in docs (perhaps it is documented somewhere?), I went digging into the code and found it in here:
https://github.com/callstack/haul/blob/next/src/utils/makeReactNativeConfig.js
Like I said, I'm not sure if this should be necessary, but it was a way that I got it to work.