-
Notifications
You must be signed in to change notification settings - Fork 182
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
react-native-builder-bob >= 0.28.0
generate package.json
in the lib
with {"type":"module"}
content
#621
Comments
What's the issue? Can you describe the scenario it is breaking so it can be addressed appropriately? |
@satya164 Thanks for your question. The scenario is next: I'm currently working on developing and publishing my private React Native material design package. To build the library and publish it, I'm using After updating
As I described earlier, that this issue arises due to |
I recommend setting While removing the |
Unfortunately,
I completely agree that removing |
The error says that Adding an option specifically for this won't fix the actual issue - webpack isn't configured properly for React Native libs. Your configuration will still break for other React Native libraries. Our goal is to have a consistent setup that works for all React Native libs - so we can standardize on the bundler configuration for everyone. Adding options that alter how the bundler needs to be configured makes this goal harder to achieve. So we'd either remove this entirely if it's not possible to have a bundler configuration that works properly with this setup, or fix the bundler setups to be aligned. If your library isn't for React Native specifically and hence you don't want to disable |
My library is developing for react-native and react-native-web. Below is my webpack config
and build config
|
@mskorenkyi I don't see your full {
test: /\.(js|jsx)$/,
include: regex_for_library_path,
resolve: {
fullySpecified: false,
},
}, For app code, webpack configs should include the following so libraries with ESM code can work: {
test: /\.(js|jsx)$/,
include: /node_modules/,
resolve: {
fullySpecified: false,
},
}, Here is a repo with a minimal webpack config that demonstrates this https://github.com/satya164/bob-webpack-example To test, run |
Description
After upgrading the version of the
react-native-builder-bob
to the latest version, I encountered an issue where the builder started generating apackage.json
file with content{"type":"module"}
in theoutput
directory (in my case, inlib
). Upon investigation, I discovered that these changes were responsible for this behavior.Unfortunately, I was unable to find any option to prevent the creation of the
package.json
in theoutput
directory. The only solution I found was to manually remove it from my end after the build was completed byreact-native-builder-bob
.Packages
Selected options
Below is my
react-native-builder-bob
config.Link to repro
https://github.com/mskorenkyi/BobIssue/
Environment
System:
OS: macOS 14.2.1
CPU: (8) arm64 Apple M1 Pro
Binaries:
Node:
version: 20.12.2
path: ~/.nvm/versions/node/v20.12.2/bin/node
Yarn:
version: 1.22.22
path: ~/.nvm/versions/node/v20.12.2/bin/yarn
npm:
version: 10.8.1
path: ~/.nvm/versions/node/v20.12.2/bin/npm
The text was updated successfully, but these errors were encountered: